class TCPDFBarcode


Located at : UKNOWVA_ROOT/libraries/tcpdf/barcodes.php

Methods

__construct($code, $type)

This is the class constructor.

array
getBarcodeArray()

Return an array representations of barcode.

getBarcodeSVG($w = 2, $h = 30, $color = 'black')

Send barcode as SVG image object to the standard output.

string
getBarcodeSVGcode($w = 2, $h = 30, $color = 'black')

Return a SVG string representation of barcode.

string
getBarcodeHTML($w = 2, $h = 30, $color = 'black')

Return an HTML representation of barcode.

image
getBarcodePNG($w = 2, $h = 30, $color = array(0, 0, 0))

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

array
setBarcode($code, $type)

Set the barcode.

string
dec_to_hex($number)

Convert large integer number to hexadecimal representation.

string
hex_to_dec($hex)

Convert large hexadecimal number to decimal representation (string).

Details

at line 73
__construct($code, $type)

This is the class constructor.

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 Extention
  • EAN5 : 5-Digits UPC-Based Extention
  • 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

at line 82
array getBarcodeArray()

Return an array representations of barcode.

Return Value

array

at line 93
getBarcodeSVG($w = 2, $h = 30, $color = 'black')

Send barcode as SVG image object to the standard output.

Parameters

$w (int) Minimum width of a single bar in user units.
$h (int) Height of barcode in user units.
$color (string) Foreground color (in SVG format) for bar elements (background is transparent).

at line 114
string getBarcodeSVGcode($w = 2, $h = 30, $color = 'black')

Return a SVG string representation of barcode.

Parameters

$w (int) Minimum width of a single bar in user units.
$h (int) Height of barcode in user units.
$color (string) Foreground color (in SVG format) for bar elements (background is transparent).

Return Value

string SVG code.

at line 147
string getBarcodeHTML($w = 2, $h = 30, $color = 'black')

Return an HTML representation of barcode.

Parameters

$w (int) Width of a single bar element in pixels.
$h (int) Height of a single bar element in pixels.
$color (string) Foreground color for bar elements (background is transparent).

Return Value

string HTML code.

at line 173
image getBarcodePNG($w = 2, $h = 30, $color = array(0, 0, 0))

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

Parameters

$w (int) Width of a single bar element in pixels.
$h (int) Height of a single bar element in pixels.
$color (array) RGB (0-255) foreground color for bar elements (background is transparent).

Return Value

image or false in case of error.

at line 233
array setBarcode($code, $type)

Set the barcode.

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 Extention
  • EAN5 : 5-Digits UPC-Based Extention
  • 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

Return Value

array barcode array

at line 2159
string dec_to_hex($number)

Convert large integer number to hexadecimal representation.

(requires PHP bcmath extension)

Parameters

$number (string) number to convert specified as a string

Return Value

string hexadecimal representation

at line 2183
string hex_to_dec($hex)

Convert large hexadecimal number to decimal representation (string).

(requires PHP bcmath extension)

Parameters

$hex (string) hexadecimal number to convert specified as a string

Return Value

string hexadecimal representation