Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org). More...
Public Member Functions | |
__construct ($code, $type) | |
This is the class constructor. | |
dec_to_hex ($number) | |
Convert large integer number to hexadecimal representation. | |
getBarcodeArray () | |
Return an array representations of barcode. | |
getBarcodeHTML ($w=2, $h=30, $color='black') | |
Return an HTML representation of barcode. | |
getBarcodePNG ($w=2, $h=30, $color=array(0, 0, 0)) | |
Send a PNG image representation of barcode (requires GD or Imagick library). | |
getBarcodePngData ($w=2, $h=30, $color=array(0, 0, 0)) | |
Return a PNG image representation of barcode (requires GD or Imagick library). | |
getBarcodeSVG ($w=2, $h=30, $color='black') | |
Send barcode as SVG image object to the standard output. | |
getBarcodeSVGcode ($w=2, $h=30, $color='black') | |
Return a SVG string representation of barcode. | |
hex_to_dec ($hex) | |
Convert large hexadecimal number to decimal representation (string). | |
setBarcode ($code, $type) | |
Set the barcode. | |
Protected Member Functions | |
barcode_c128 ($code, $type='') | |
C128 barcodes. | |
barcode_codabar ($code) | |
CODABAR barcodes. | |
barcode_code11 ($code) | |
CODE11 barcodes. | |
barcode_code39 ($code, $extended=false, $checksum=false) | |
CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9. | |
barcode_code93 ($code) | |
CODE 93 - USS-93 Compact code similar to Code 39. | |
barcode_eanext ($code, $len=5) | |
UPC-Based Extensions 2-Digit Ext.: Used to indicate magazines and newspaper issue numbers 5-Digit Ext.: Used to mark suggested retail price of books. | |
barcode_eanupc ($code, $len=13) | |
EAN13 and UPC-A barcodes. | |
barcode_i25 ($code, $checksum=false) | |
Interleaved 2 of 5 barcodes. | |
barcode_imb ($code) | |
IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200 (requires PHP bcmath extension) Intelligent Mail barcode is a 65-bar code for use on mail in the United States. | |
barcode_imb_pre ($code) | |
IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200. | |
barcode_msi ($code, $checksum=false) | |
MSI. | |
barcode_pharmacode ($code) | |
Pharmacode Contains digits (0 to 9) | |
barcode_pharmacode2t ($code) | |
Pharmacode two-track Contains digits (0 to 9) | |
barcode_postnet ($code, $planet=false) | |
POSTNET and PLANET barcodes. | |
barcode_rms4cc ($code, $kix=false) | |
RMS4CC - CBC - KIX RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) - KIX (Klant index - Customer index) RM4SCC is the name of the barcode symbology used by the Royal Mail for its Cleanmail service. | |
barcode_s25 ($code, $checksum=false) | |
Standard 2 of 5 barcodes. | |
binseq_to_array ($seq, $bararray) | |
Convert binary barcode sequence to WarnockPDF barcode array. | |
checksum_code39 ($code) | |
Calculate CODE 39 checksum (modulo 43). | |
checksum_code93 ($code) | |
Calculate CODE 93 checksum (modulo 47). | |
checksum_s25 ($code) | |
Checksum for standard 2 of 5 barcodes. | |
encode_code39_ext ($code) | |
Encode a string to be used for CODE 39 Extended mode. | |
get128ABsequence ($code) | |
Split text code in A/B sequence for 128 code. | |
imb_crc11fcs ($code_arr) | |
Intelligent Mail Barcode calculation of Frame Check Sequence. | |
imb_reverse_us ($num) | |
Reverse unsigned short value. | |
imb_tables ($n, $size) | |
generate Nof13 tables used for Intelligent Mail Barcode | |
Protected Attributes | |
$barcode_array = array() | |
Array representation of barcode. | |
PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).
..
TCPDFBarcode::__construct | ( | $code, | |
$type ) |
This is the class constructor.
Return an array representations for common 1D barcodes:
string | $code | code to print |
string | $type | type of barcode:
|
|
protected |
C128 barcodes.
Very capable code, excellent density, high reliability; in very wide use world-wide
string | $code | code to represent. |
string | $type | barcode type: A, B, C or empty for automatic switch (AUTO mode) |
array | barcode representation. |
|
protected |
CODABAR barcodes.
Older code often used in library systems, sometimes in blood banks
string | $code | code to represent. |
array | barcode representation. |
|
protected |
CODE11 barcodes.
Used primarily for labeling telecommunications equipment
string | $code | code to represent. |
array | barcode representation. |
|
protected |
CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
General-purpose code in very wide use world-wide
string | $code | code to represent. |
boolean | $extended | if true uses the extended mode. |
boolean | $checksum | if true add a checksum to the code. |
array | barcode representation. |
|
protected |
CODE 93 - USS-93 Compact code similar to Code 39.
string | $code | code to represent. |
array | barcode representation. |
|
protected |
UPC-Based Extensions 2-Digit Ext.: Used to indicate magazines and newspaper issue numbers 5-Digit Ext.: Used to mark suggested retail price of books.
string | $code | code to represent. |
string | $len | barcode type: 2 = 2-Digit, 5 = 5-Digit |
array | barcode representation. |
|
protected |
EAN13 and UPC-A barcodes.
EAN13: European Article Numbering international retail product code UPC-A: Universal product code seen on almost all retail products in the USA and Canada UPC-E: Short version of UPC symbol
string | $code | code to represent. |
string | $len | barcode type: 6 = UPC-E, 8 = EAN8, 13 = EAN13, 12 = UPC-A |
array | barcode representation. |
|
protected |
Interleaved 2 of 5 barcodes.
Compact numeric code, widely used in industry, air cargo Contains digits (0 to 9) and encodes the data in the width of both bars and spaces.
string | $code | code to represent. |
boolean | $checksum | if true add a checksum to the code |
array | barcode representation. |
|
protected |
IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200 (requires PHP bcmath extension) Intelligent Mail barcode is a 65-bar code for use on mail in the United States.
The fields are described as follows:
string | $code | code to print, separate the ZIP (routing code) from the rest using a minus char '-' (BarcodeID_ServiceTypeID_MailerID_SerialNumber-RoutingCode) |
array | barcode representation. |
|
protected |
IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200.
string | $code | pre-formatted IMB barcode (65 chars "FADT") |
array | barcode representation. |
|
protected |
MSI.
Variation of Plessey code, with similar applications Contains digits (0 to 9) and encodes the data only in the width of bars.
string | $code | code to represent. |
boolean | $checksum | if true add a checksum to the code (modulo 11) |
array | barcode representation. |
|
protected |
Pharmacode Contains digits (0 to 9)
string | $code | code to represent. |
array | barcode representation. |
|
protected |
Pharmacode two-track Contains digits (0 to 9)
string | $code | code to represent. |
array | barcode representation. |
|
protected |
POSTNET and PLANET barcodes.
Used by U.S. Postal Service for automated mail sorting
string | $code | zip code to represent. Must be a string containing a zip code of the form DDDDD or DDDDD-DDDD. |
boolean | $planet | if true print the PLANET barcode, otherwise print POSTNET |
array | barcode representation. |
|
protected |
RMS4CC - CBC - KIX RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) - KIX (Klant index - Customer index) RM4SCC is the name of the barcode symbology used by the Royal Mail for its Cleanmail service.
string | $code | code to print |
boolean | $kix | if true prints the KIX variation (doesn't use the start and end symbols, and the checksum) - in this case the house number must be sufficed with an X and placed at the end of the code. |
array | barcode representation. |
|
protected |
Standard 2 of 5 barcodes.
Used in airline ticket marking, photofinishing Contains digits (0 to 9) and encodes the data only in the width of bars.
string | $code | code to represent. |
boolean | $checksum | if true add a checksum to the code |
array | barcode representation. |
|
protected |
Convert binary barcode sequence to WarnockPDF barcode array.
string | $seq | barcode as binary sequence. |
array | $bararray | barcode array to fill up |
array | barcode representation. |
|
protected |
Calculate CODE 39 checksum (modulo 43).
string | $code | code to represent. |
string | char checksum. |
|
protected |
Calculate CODE 93 checksum (modulo 47).
string | $code | code to represent. |
string | checksum code. |
|
protected |
Checksum for standard 2 of 5 barcodes.
string | $code | code to process. |
int | checksum. |
TCPDFBarcode::dec_to_hex | ( | $number | ) |
Convert large integer number to hexadecimal representation.
(requires PHP bcmath extension)
string | $number | number to convert specified as a string |
string | hexadecimal representation |
|
protected |
Encode a string to be used for CODE 39 Extended mode.
string | $code | code to represent. |
string | encoded string. |
|
protected |
Split text code in A/B sequence for 128 code.
string | $code | code to split. |
array | sequence |
TCPDFBarcode::getBarcodeArray | ( | ) |
Return an array representations of barcode.
array |
TCPDFBarcode::getBarcodeHTML | ( | $w = 2, | |
$h = 30, | |||
$color = 'black' ) |
Return an HTML representation of barcode.
int | $w | Width of a single bar element in pixels. |
int | $h | Height of a single bar element in pixels. |
string | $color | Foreground color for bar elements (background is transparent). |
string | HTML code. |
TCPDFBarcode::getBarcodePNG | ( | $w = 2, | |
$h = 30, | |||
$color = array(0,0,0) ) |
Send a PNG image representation of barcode (requires GD or Imagick library).
int | $w | Width of a single bar element in pixels. |
int | $h | Height of a single bar element in pixels. |
array | $color | RGB (0-255) foreground color for bar elements (background is transparent). |
TCPDFBarcode::getBarcodePngData | ( | $w = 2, | |
$h = 30, | |||
$color = array(0,0,0) ) |
Return a PNG image representation of barcode (requires GD or Imagick library).
int | $w | Width of a single bar element in pixels. |
int | $h | Height of a single bar element in pixels. |
array | $color | RGB (0-255) foreground color for bar elements (background is transparent). |
string|Imagick|false | image or false in case of error. |
TCPDFBarcode::getBarcodeSVG | ( | $w = 2, | |
$h = 30, | |||
$color = 'black' ) |
Send barcode as SVG image object to the standard output.
int | $w | Minimum width of a single bar in user units. |
int | $h | Height of barcode in user units. |
string | $color | Foreground color (in SVG format) for bar elements (background is transparent). |
TCPDFBarcode::getBarcodeSVGcode | ( | $w = 2, | |
$h = 30, | |||
$color = 'black' ) |
Return a SVG string representation of barcode.
int | $w | Minimum width of a single bar in user units. |
int | $h | Height of barcode in user units. |
string | $color | Foreground color (in SVG format) for bar elements (background is transparent). |
string | SVG code. |
TCPDFBarcode::hex_to_dec | ( | $hex | ) |
Convert large hexadecimal number to decimal representation (string).
(requires PHP bcmath extension)
string | $hex | hexadecimal number to convert specified as a string |
string | hexadecimal representation |
|
protected |
Intelligent Mail Barcode calculation of Frame Check Sequence.
string | $code_arr | array of hexadecimal values (13 bytes holding 102 bits right justified). |
int | 11 bit Frame Check Sequence as integer (decimal base) |
|
protected |
Reverse unsigned short value.
int | $num | value to reversr |
int | reversed value |
|
protected |
generate Nof13 tables used for Intelligent Mail Barcode
int | $n | is the type of table: 2 for 2of13 table, 5 for 5of13table |
int | $size | size of table (78 for n=2 and 1287 for n=5) |
array | requested table |
TCPDFBarcode::setBarcode | ( | $code, | |
$type ) |
Set the barcode.
string | $code | code to print |
string | $type | type of barcode:
|
void |