Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
PDF417 Class Reference

Class to create PDF417 barcode arrays for TCPDF class. More...

Public Member Functions

 __construct ($code, $ecl=-1, $aspectratio=2, $macro=array())
 This is the class constructor.
 
 getBarcodeArray ()
 Returns a barcode array which is readable by TCPDF.
 

Protected Member Functions

 getCompaction ($mode, $code, $addmode=true)
 Compact data by mode.
 
 getErrorCorrection ($cw, $ecl)
 Returns the error correction codewords.
 
 getErrorCorrectionLevel ($ecl, $numcw)
 Returns the error correction level (0-8) to be used.
 
 getInputSequences ($code)
 Create array of sequences from input.
 

Protected Attributes

 $barcode_array = array()
 Barcode array to be returned which is readable by TCPDF.
 
 $clusters
 Clusters of codewords (0, 3, 6)
Values are hex equivalents of binary representation of bars (1 = bar, 0 = space).
 
 $rsfactors
 Array of factors of the Reed-Solomon polynomial equations used for error correction; one sub array for each correction level (0-8).
 
 $start_pattern = '11111111010101000'
 Start pattern.
 
 $stop_pattern = '111111101000101001'
 Stop pattern.
 
 $textlatch
 Array of switching codes for Text Compaction Sub-Modes.
 
 $textsubmodes
 Array of text Compaction Sub-Modes (values 0xFB - 0xFF are used for submode changers).
 

Detailed Description

Class to create PDF417 barcode arrays for TCPDF class.

PDF417 (ISO/IEC 15438:2006) is a 2-dimensional stacked bar code created by Symbol Technologies in 1991. ..

Author
Nicola Asuni
Version
1.0.003

Constructor & Destructor Documentation

◆ __construct()

PDF417::__construct ( $code,
$ecl = -1,
$aspectratio = 2,
$macro = array() )

This is the class constructor.

Creates a PDF417 object

Parameters
string$codecode to represent using PDF417
int$eclerror correction level (0-8); default -1 = automatic correction level
float$aspectratiothe width to height of the symbol (excluding quiet zones)
array$macroinformation for macro block

Member Function Documentation

◆ getBarcodeArray()

PDF417::getBarcodeArray ( )

Returns a barcode array which is readable by TCPDF.

Return values
arraybarcode array readable by TCPDF;

◆ getCompaction()

PDF417::getCompaction ( $mode,
$code,
$addmode = true )
protected

Compact data by mode.

Parameters
int$modecompaction mode number
string$codedata to compact
boolean$addmodeif true add the mode codeword at first position
Return values
arrayof codewords

◆ getErrorCorrection()

PDF417::getErrorCorrection ( $cw,
$ecl )
protected

Returns the error correction codewords.

Parameters
array$cwarray of codewords including Symbol Length Descriptor and pad
int$eclerror correction level 0-8
Return values
arrayof error correction codewords

◆ getErrorCorrectionLevel()

PDF417::getErrorCorrectionLevel ( $ecl,
$numcw )
protected

Returns the error correction level (0-8) to be used.

Parameters
int$eclerror correction level
int$numcwnumber of data codewords
Return values
interror correction level

◆ getInputSequences()

PDF417::getInputSequences ( $code)
protected

Create array of sequences from input.

Parameters
string$codecode
Return values
arraybi-dimensional array containing characters and classification

Member Data Documentation

◆ $clusters

PDF417::$clusters
protected

Clusters of codewords (0, 3, 6)
Values are hex equivalents of binary representation of bars (1 = bar, 0 = space).


The codewords numbered from 900 to 928 have special meaning, some enable to switch between modes in order to optimise the code:

  • 900 : Switch to "Text" mode
  • 901 : Switch to "Byte" mode
  • 902 : Switch to "Numeric" mode
  • 903 - 912 : Reserved
  • 913 : Switch to "Octet" only for the next codeword
  • 914 - 920 : Reserved
  • 921 : Initialization
  • 922 : Terminator codeword for Macro PDF control block
  • 923 : Sequence tag to identify the beginning of optional fields in the Macro PDF control block
  • 924 : Switch to "Byte" mode (If the total number of byte is multiple of 6)
  • 925 : Identifier for a user defined Extended Channel Interpretation (ECI)
  • 926 : Identifier for a general purpose ECI format
  • 927 : Identifier for an ECI of a character set or code page
  • 928 : Macro marker codeword to indicate the beginning of a Macro PDF Control Block

◆ $textlatch

PDF417::$textlatch
protected
Initial value:
= array(
'01' => array(27), '02' => array(28), '03' => array(28,25),
'10' => array(28,28), '12' => array(28), '13' => array(28,25),
'20' => array(28), '21' => array(27), '23' => array(25),
'30' => array(29), '31' => array(29,27), '32' => array(29,28)
)

Array of switching codes for Text Compaction Sub-Modes.

◆ $textsubmodes

PDF417::$textsubmodes
protected
Initial value:
= array(
array(0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x20,0xFD,0xFE,0xFF),
array(0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x20,0xFD,0xFE,0xFF),
array(0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x26,0x0d,0x09,0x2c,0x3a,0x23,0x2d,0x2e,0x24,0x2f,0x2b,0x25,0x2a,0x3d,0x5e,0xFB,0x20,0xFD,0xFE,0xFF),
array(0x3b,0x3c,0x3e,0x40,0x5b,0x5c,0x5d,0x5f,0x60,0x7e,0x21,0x0d,0x09,0x2c,0x3a,0x0a,0x2d,0x2e,0x24,0x2f,0x22,0x7c,0x2a,0x28,0x29,0x3f,0x7b,0x7d,0x27,0xFF)
)

Array of text Compaction Sub-Modes (values 0xFB - 0xFF are used for submode changers).


The documentation for this class was generated from the following file: