Datamatrix

class

Datamatrix Class to create DataMatrix ECC 200 barcode arrays for TCPDF class. DataMatrix (ISO/IEC 16022:2006) is a 2-dimensional bar code.

package

com.tecnick.tcpdf

author

Nicola Asuni

version 1.0.004

Methods

This is the class constructor.

__construct(string $code)

Creates a datamatrix object

public

Arguments

$code

string

Code to represent using Datamatrix.

Return the 253-state codeword

get253StateCodeword(integer $cwpad,integer $cwpos): integer
protected

Arguments

$cwpad

integer

Pad codeword.

$cwpos

integer

Number of data codewords from the beginning of encoded data.

Response

integer

pad codeword

Return the 255-state codeword

get255StateCodeword(integer $cwpad,integer $cwpos): integer
protected

Arguments

$cwpad

integer

Pad codeword.

$cwpos

integer

Number of data codewords from the beginning of encoded data.

Response

integer

pad codeword

Returns a barcode array which is readable by TCPDF

getBarcodeArray(): array
public

Response

array

barcode array readable by TCPDF;

Add error correction codewords to data codewords array (ANNEX E).

getErrorCorrection(array $wd,integer $nb,integer $nd,integer $nc,integer $gf = 256,integer $pp = 301): array
protected

Arguments

$wd

array

Array of datacodewords.

$nb

integer

Number of blocks.

$nd

integer

Number of data codewords per block.

$nc

integer

Number of correction codewords per block.

$gf

integer

numner of fields on log/antilog table (power of 2).

$pp

integer

The value of its prime modulus polynomial (301 for ECC200).

Response

array

data codewords + error codewords

Product of two numbers in a Power-of-Two Galois Field

getGFProduct(integer $a,integer $b,array $log,array $alog,integer $gf): integer
protected

Arguments

$a

integer

first number to multiply.

$b

integer

second number to multiply.

$log

array

Log table.

$alog

array

Anti-Log table.

$gf

integer

Number of Factors of the Reed-Solomon polynomial.

Response

integer

product

Get high level encoding using the minimum symbol data characters for ECC 200

getHighLevelEncoding(string $data): array
protected

Arguments

$data

string

data to encode

Response

array

of codewords

Choose the minimum matrix size and return the max number of data codewords.

getMaxDataCodewords(integer $numcw): integer
protected

Arguments

$numcw

integer

Number of current codewords.

Response

integer

number of data codewords in matrix

Build a placement map.

getPlacementMap(integer $nrow,integer $ncol): array

(Annex F - ECC 200 symbol character placement)

protected

Arguments

$nrow

integer

Number of rows.

$ncol

integer

Number of columns.

Response

array

Get the switching codeword to a new encoding mode (latch codeword)

getSwitchEncodingCodeword(integer $mode): integer
protected

Arguments

$mode

integer

New encoding mode.

Response

integer

Switch codeword.

Returns true if the char belongs to the selected mode

isCharMode(integer $chr,integer $mode): boolean
protected

Arguments

$chr

integer

Character (byte) to check.

$mode

integer

Current encoding mode.

Response

boolean

true if the char is of the selected mode.

The look-ahead test scans the data to be encoded to find the best mode (Annex P - steps from J to S).

lookAheadTest(string $data,integer $pos,integer $mode): integer
protected

Arguments

$data

string

data to encode

$pos

integer

current position

$mode

integer

current encoding mode

Response

integer

encoding mode

Places the 8 bits of the first special corner case.

placeCornerA(array $marr,integer $nrow,integer $ncol,integer $chr): array

(Annex F - ECC 200 symbol character placement)

protected

Arguments

$marr

array

Array of symbols.

$nrow

integer

Number of rows.

$ncol

integer

Number of columns.

$chr

integer

Char byte.

Response

array

Places the 8 bits of the second special corner case.

placeCornerB(array $marr,integer $nrow,integer $ncol,integer $chr): array

(Annex F - ECC 200 symbol character placement)

protected

Arguments

$marr

array

Array of symbols.

$nrow

integer

Number of rows.

$ncol

integer

Number of columns.

$chr

integer

Char byte.

Response

array

Places the 8 bits of the third special corner case.

placeCornerC(array $marr,integer $nrow,integer $ncol,integer $chr): array

(Annex F - ECC 200 symbol character placement)

protected

Arguments

$marr

array

Array of symbols.

$nrow

integer

Number of rows.

$ncol

integer

Number of columns.

$chr

integer

Char byte.

Response

array

Places the 8 bits of the fourth special corner case.

placeCornerD(array $marr,integer $nrow,integer $ncol,integer $chr): array

(Annex F - ECC 200 symbol character placement)

protected

Arguments

$marr

array

Array of symbols.

$nrow

integer

Number of rows.

$ncol

integer

Number of columns.

$chr

integer

Char byte.

Response

array

Places "chr+bit" with appropriate wrapping within array[].

placeModule(array $marr,integer $nrow,integer $ncol,integer $row,integer $col,integer $chr,integer $bit): array

(Annex F - ECC 200 symbol character placement)

protected

Arguments

$marr

array

Array of symbols.

$nrow

integer

Number of rows.

$ncol

integer

Number of columns.

$row

integer

Row number.

$col

integer

Column number.

$chr

integer

Char byte.

$bit

integer

Bit.

Response

array

Places the 8 bits of a utah-shaped symbol character.

placeUtah(array $marr,integer $nrow,integer $ncol,integer $row,integer $col,integer $chr): array

(Annex F - ECC 200 symbol character placement)

protected

Arguments

$marr

array

Array of symbols.

$nrow

integer

Number of rows.

$ncol

integer

Number of columns.

$row

integer

Row number.

$col

integer

Column number.

$chr

integer

Char byte.

Response

array

Properties

Barcode array to be returned which is readable by TCPDF.

barcode_array :
protected

Type(s)

Store last used encoding for data codewords.

last_enc :
protected

Type(s)

Table of Data Matrix ECC 200 Symbol Attributes:<ul> <li>total matrix rows (including finder pattern)</li> <li>total matrix cols (including finder pattern)</li> <li>total matrix rows (without finder pattern)</li> <li>total matrix cols (without finder pattern)</li> <li>region data rows (with finder pattern)</li> <li>region data col (with finder pattern)</li> <li>region data rows (without finder pattern)</li> <li>region data col (without finder pattern)</li> <li>horizontal regions</li> <li>vertical regions</li> <li>regions</li> <li>data codewords</li> <li>error codewords</li> <li>blocks</li> <li>data codewords per block</li> <li>error codewords per block</li> </ul>

symbattr :
protected

Type(s)

Map encodation modes whit character sets.

chset_id :
protected

Type(s)

Basic set of characters for each encodation mode.

chset :
protected

Type(s)