classes-TCPDFBarcode

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

    TCPDFBarcode

    in package

    Tags
    class

    TCPDFBarcode PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).

    version
    1.0.027
    author

    Nicola Asuni

    Table of Contents

    Methods

    __construct()  : mixed
    This is the class constructor.
    dec_to_hex()  : string
    Convert large integer number to hexadecimal representation.
    getBarcodeArray()  : array<string|int, mixed>
    Return an array representations of barcode.
    getBarcodeHTML()  : string
    Return an HTML representation of barcode.
    getBarcodePNG()  : mixed
    Send a PNG image representation of barcode (requires GD or Imagick library).
    getBarcodePngData()  : string|Imagick|false
    Return a PNG image representation of barcode (requires GD or Imagick library).
    getBarcodeSVG()  : mixed
    Send barcode as SVG image object to the standard output.
    getBarcodeSVGcode()  : string
    Return a SVG string representation of barcode.
    hex_to_dec()  : string
    Convert large hexadecimal number to decimal representation (string).
    setBarcode()  : void
    Set the barcode.

    Methods

    __construct()

    This is the class constructor.

    public __construct(string $code, string $type) : mixed

    Return an array representations for common 1D barcodes:

    • $arrcode['code'] code to be printed on text label
    • $arrcode['maxh'] max barcode height
    • $arrcode['maxw'] max barcode width
    • $arrcode['bcode'][$k] single bar or space in $k position
    • $arrcode['bcode'][$k]['t'] bar type: true = bar, false = space.
    • $arrcode['bcode'][$k]['w'] bar width in units.
    • $arrcode['bcode'][$k]['h'] bar height in units.
    • $arrcode['bcode'][$k]['p'] bar top position (0 = top, 1 = middle)
    Parameters
    $code : string

    code to print

    $type : string

    type of barcode:

    • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
    • C39+ : CODE 39 with checksum
    • C39E : CODE 39 EXTENDED
    • C39E+ : CODE 39 EXTENDED + CHECKSUM
    • C93 : CODE 93 - USS-93
    • S25 : Standard 2 of 5
    • S25+ : Standard 2 of 5 + CHECKSUM
    • I25 : Interleaved 2 of 5
    • I25+ : Interleaved 2 of 5 + CHECKSUM
    • C128 : CODE 128
    • C128A : CODE 128 A
    • C128B : CODE 128 B
    • C128C : CODE 128 C
    • EAN2 : 2-Digits UPC-Based Extension
    • EAN5 : 5-Digits UPC-Based Extension
    • EAN8 : EAN 8
    • EAN13 : EAN 13
    • UPCA : UPC-A
    • UPCE : UPC-E
    • MSI : MSI (Variation of Plessey code)
    • MSI+ : MSI + CHECKSUM (modulo 11)
    • POSTNET : POSTNET
    • PLANET : PLANET
    • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
    • KIX : KIX (Klant index - Customer index)
    • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
    • CODABAR : CODABAR
    • CODE11 : CODE 11
    • PHARMA : PHARMACODE
    • PHARMA2T : PHARMACODE TWO-TRACKS
    Tags
    public

    dec_to_hex()

    Convert large integer number to hexadecimal representation.

    public dec_to_hex(string $number) : string

    (requires PHP bcmath extension)

    Parameters
    $number : string

    number to convert specified as a string

    Return values
    string

    hexadecimal representation

    getBarcodeArray()

    Return an array representations of barcode.

    public getBarcodeArray() : array<string|int, mixed>
    Tags
    public
    Return values
    array<string|int, mixed>

    getBarcodeHTML()

    Return an HTML representation of barcode.

    public getBarcodeHTML([int $w = 2 ][, int $h = 30 ][, string $color = 'black' ]) : string
    Parameters
    $w : int = 2

    Width of a single bar element in pixels.

    $h : int = 30

    Height of a single bar element in pixels.

    $color : string = 'black'

    Foreground color for bar elements (background is transparent).

    Tags
    public
    Return values
    string

    HTML code.

    getBarcodePNG()

    Send a PNG image representation of barcode (requires GD or Imagick library).

    public getBarcodePNG([int $w = 2 ][, int $h = 30 ][, array<string|int, mixed> $color = array(0, 0, 0) ]) : mixed
    Parameters
    $w : int = 2

    Width of a single bar element in pixels.

    $h : int = 30

    Height of a single bar element in pixels.

    $color : array<string|int, mixed> = array(0, 0, 0)

    RGB (0-255) foreground color for bar elements (background is transparent).

    Tags
    public

    getBarcodePngData()

    Return a PNG image representation of barcode (requires GD or Imagick library).

    public getBarcodePngData([int $w = 2 ][, int $h = 30 ][, array<string|int, mixed> $color = array(0, 0, 0) ]) : string|Imagick|false
    Parameters
    $w : int = 2

    Width of a single bar element in pixels.

    $h : int = 30

    Height of a single bar element in pixels.

    $color : array<string|int, mixed> = array(0, 0, 0)

    RGB (0-255) foreground color for bar elements (background is transparent).

    Tags
    public
    Return values
    string|Imagick|false

    image or false in case of error.

    getBarcodeSVG()

    Send barcode as SVG image object to the standard output.

    public getBarcodeSVG([int $w = 2 ][, int $h = 30 ][, string $color = 'black' ]) : mixed
    Parameters
    $w : int = 2

    Minimum width of a single bar in user units.

    $h : int = 30

    Height of barcode in user units.

    $color : string = 'black'

    Foreground color (in SVG format) for bar elements (background is transparent).

    Tags
    public

    getBarcodeSVGcode()

    Return a SVG string representation of barcode.

    public getBarcodeSVGcode([int $w = 2 ][, int $h = 30 ][, string $color = 'black' ]) : string
    Parameters
    $w : int = 2

    Minimum width of a single bar in user units.

    $h : int = 30

    Height of barcode in user units.

    $color : string = 'black'

    Foreground color (in SVG format) for bar elements (background is transparent).

    Tags
    public
    Return values
    string

    SVG code.

    hex_to_dec()

    Convert large hexadecimal number to decimal representation (string).

    public hex_to_dec(string $hex) : string

    (requires PHP bcmath extension)

    Parameters
    $hex : string

    hexadecimal number to convert specified as a string

    Return values
    string

    hexadecimal representation

    setBarcode()

    Set the barcode.

    public setBarcode(string $code, string $type) : void
    Parameters
    $code : string

    code to print

    $type : string

    type of barcode:

    • C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
    • C39+ : CODE 39 with checksum
    • C39E : CODE 39 EXTENDED
    • C39E+ : CODE 39 EXTENDED + CHECKSUM
    • C93 : CODE 93 - USS-93
    • S25 : Standard 2 of 5
    • S25+ : Standard 2 of 5 + CHECKSUM
    • I25 : Interleaved 2 of 5
    • I25+ : Interleaved 2 of 5 + CHECKSUM
    • C128 : CODE 128
    • C128A : CODE 128 A
    • C128B : CODE 128 B
    • C128C : CODE 128 C
    • EAN2 : 2-Digits UPC-Based Extension
    • EAN5 : 5-Digits UPC-Based Extension
    • EAN8 : EAN 8
    • EAN13 : EAN 13
    • UPCA : UPC-A
    • UPCE : UPC-E
    • MSI : MSI (Variation of Plessey code)
    • MSI+ : MSI + CHECKSUM (modulo 11)
    • POSTNET : POSTNET
    • PLANET : PLANET
    • RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)
    • KIX : KIX (Klant index - Customer index)
    • IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200
    • IMBPRE: Pre-processed Intelligent Mail Barcode - Onecode - USPS-B-3200, using only F,A,D,T letters
    • CODABAR : CODABAR
    • CODE11 : CODE 11
    • PHARMA : PHARMACODE
    • PHARMA2T : PHARMACODE TWO-TRACKS
    Tags
    public
    On this page
     

    © 2004-2024 – Nicola Asuni - Tecnick.com - All rights reserved.
    about - disclaimer - privacy