TCPDF2DBarcode
in package
Tags
Table of Contents
Properties
- $barcode_array : mixed
- Array representation of barcode.
Methods
- __construct() : mixed
- This is the class constructor.
- 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.
- setBarcode() : void
- Set the barcode.
Properties
$barcode_array
Array representation of barcode.
protected
mixed
$barcode_array
= array()
Tags
Methods
__construct()
This is the class constructor.
public
__construct(string $code, string $type) : mixed
Return an array representations for 2D barcodes:
- $arrcode['code'] code to be printed on text label
- $arrcode['num_rows'] required number of rows
- $arrcode['num_cols'] required number of columns
- $arrcode['bcode'][$r][$c] value of the cell is $r row and $c column (0 = transparent, 1 = black)
Parameters
- $code : string
-
code to print
- $type : string
-
type of barcode:
- DATAMATRIX : Datamatrix (ISO/IEC 16022)
- PDF417 : PDF417 (ISO/IEC 15438:2006)
- PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parameters are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".
- QRCODE : QRcode Low error correction
- QRCODE,L : QRcode Low error correction
- QRCODE,M : QRcode Medium error correction
- QRCODE,Q : QRcode Better error correction
- QRCODE,H : QR-CODE Best error correction
- RAW: raw mode - comma-separad list of array rows
- RAW2: raw mode - array rows are surrounded by square parenthesis.
- TEST : Test matrix
getBarcodeArray()
Return an array representations of barcode.
public
getBarcodeArray() : array<string|int, mixed>
Return values
array<string|int, mixed>getBarcodeHTML()
Return an HTML representation of barcode.
public
getBarcodeHTML([int $w = 10 ][, int $h = 10 ][, string $color = 'black' ]) : string
Parameters
- $w : int = 10
-
Width of a single rectangle element in pixels.
- $h : int = 10
-
Height of a single rectangle element in pixels.
- $color : string = 'black'
-
Foreground color for bar elements (background is transparent).
Tags
Return values
string —HTML code.
getBarcodePNG()
Send a PNG image representation of barcode (requires GD or Imagick library).
public
getBarcodePNG([int $w = 3 ][, int $h = 3 ][, array<string|int, mixed> $color = array(0, 0, 0) ]) : mixed
Parameters
- $w : int = 3
-
Width of a single rectangle element in pixels.
- $h : int = 3
-
Height of a single rectangle element in pixels.
- $color : array<string|int, mixed> = array(0, 0, 0)
-
RGB (0-255) foreground color for bar elements (background is transparent).
Tags
getBarcodePngData()
Return a PNG image representation of barcode (requires GD or Imagick library).
public
getBarcodePngData([int $w = 3 ][, int $h = 3 ][, array<string|int, mixed> $color = array(0, 0, 0) ]) : string|Imagick|false
Parameters
- $w : int = 3
-
Width of a single rectangle element in pixels.
- $h : int = 3
-
Height of a single rectangle element in pixels.
- $color : array<string|int, mixed> = array(0, 0, 0)
-
RGB (0-255) foreground color for bar elements (background is transparent).
Tags
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 = 3 ][, int $h = 3 ][, string $color = 'black' ]) : mixed
Parameters
- $w : int = 3
-
Width of a single rectangle element in user units.
- $h : int = 3
-
Height of a single rectangle element in user units.
- $color : string = 'black'
-
Foreground color (in SVG format) for bar elements (background is transparent).
Tags
getBarcodeSVGcode()
Return a SVG string representation of barcode.
public
getBarcodeSVGcode([int $w = 3 ][, int $h = 3 ][, string $color = 'black' ]) : string
Parameters
- $w : int = 3
-
Width of a single rectangle element in user units.
- $h : int = 3
-
Height of a single rectangle element in user units.
- $color : string = 'black'
-
Foreground color (in SVG format) for bar elements (background is transparent).
Tags
Return values
string —SVG code.
setBarcode()
Set the barcode.
public
setBarcode(string $code, string $type) : void
Parameters
- $code : string
-
code to print
- $type : string
-
type of barcode:
- DATAMATRIX : Datamatrix (ISO/IEC 16022)
- PDF417 : PDF417 (ISO/IEC 15438:2006)
- PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6 : PDF417 with parameters: a = aspect ratio (width/height); e = error correction level (0-8); t = total number of macro segments; s = macro segment index (0-99998); f = file ID; o0 = File Name (text); o1 = Segment Count (numeric); o2 = Time Stamp (numeric); o3 = Sender (text); o4 = Addressee (text); o5 = File Size (numeric); o6 = Checksum (numeric). NOTES: Parameters t, s and f are required for a Macro Control Block, all other parameters are optional. To use a comma character ',' on text options, replace it with the character 255: "\xff".
- QRCODE : QRcode Low error correction
- QRCODE,L : QRcode Low error correction
- QRCODE,M : QRcode Medium error correction
- QRCODE,Q : QRcode Better error correction
- QRCODE,H : QR-CODE Best error correction
- RAW: raw mode - comma-separad list of array rows
- RAW2: raw mode - array rows are surrounded by square parenthesis.
- TEST : Test matrix