Aspose.Barcode for PHP via Java Generation and Recognition API docs
DataMatrixEncodeMode Class Reference

Public Attributes

const AUTO = 0
 
const ASCII = 1
 
const BYTES = 6
 
const C40 = 8
 
const TEXT = 9
 
const EDIFACT = 10
 
const ANSIX12 = 11
 
const EXTENDED_CODETEXT = 12
 
const EXTENDED = 13
 
const BASE_256 = 14
 
const BINARY = 15
 
const ECI = 16
 

Detailed Description

DataMatrix encoder's encoding mode, default to Auto


This sample shows how to do codetext in Extended Mode.
//Auto mode
$codetext = "犬Right狗";
$generator = new BarcodeGenerator(EncodeTypes::DATA_MATRIX, $codetext);
$generator->getParameters()->getBarcode()->getDataMatrix()->setECIEncoding(ECIEncodings::UTF8);
$generator->save("test.bmp", BarcodeImageFormat::PNG);
//Bytes mode
$encodedArr = array( 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9 );
$generator = new BarcodeGenerator(EncodeTypes::DATA_MATRIX, $encodedArr);
$generator->getParameters()->getBarcode()->getDataMatrix()->setDataMatrixEncodeMode(DataMatrixEncodeMode::BINARY);
$generator->save("test.bmp", BarcodeImageFormat::PNG);
//Extended codetext mode
//create codetext
$codetextBuilder=new DataMatrixExtCodetextBuilder();
$codetextBuilder->addECICodetextWithEncodeMode(ECIEncodings::Win1251,DataMatrixEncodeMode::BYTES,"World");
$codetextBuilder->addPlainCodetext("Will");
$codetextBuilder->addECICodetext(ECIEncodings::UTF8,"犬Right狗");
$codetextBuilder->addCodetextWithEncodeMode(DataMatrixEncodeMode::C40,"ABCDE");
//generate codetext
$codetext=$codetextBuilder->getExtended();
//generate
$generator=new BarcodeGenerator(EncodeTypes::DATA_MATRIX,codetext);
$generator->getParameters()->getBarcode()->getDataMatrix()->setDataMatrixEncodeMode(DataMatrixEncodeMode::EXTENDED_CODETEXT);
$generator->save("test.bmp", BarcodeImageFormat::PNG);

Member Data Documentation

◆ ANSIX12

const DataMatrixEncodeMode::ANSIX12 = 11

Uses ANSI X12 encoding.

◆ ASCII

const DataMatrixEncodeMode::ASCII = 1

Encodes one alphanumeric or two numeric characters per byte

◆ AUTO

const DataMatrixEncodeMode::AUTO = 0

In Auto mode, the CodeText is encoded with maximum data compactness. Unicode characters are re-encoded in the ECIEncoding specified encoding with the insertion of an ECI identifier. If a character is found that is not supported by the selected ECI encoding, an exception is thrown.

◆ BASE_256

const DataMatrixEncodeMode::BASE_256 = 14

Encode 8 bit values

◆ BINARY

const DataMatrixEncodeMode::BINARY = 15

In Binary mode, the CodeText is encoded with maximum data compactness. If a Unicode character is found, an exception is thrown.

◆ BYTES

const DataMatrixEncodeMode::BYTES = 6

Encode 8 bit values

Deprecated:
This property is obsolete and will be removed in future releases. Instead, use Base256 option.

◆ C40

const DataMatrixEncodeMode::C40 = 8

Uses C40 encoding. Encodes Upper-case alphanumeric, Lower case and special characters

◆ ECI

const DataMatrixEncodeMode::ECI = 16

In ECI mode, the entire message is re-encoded in the ECIEncoding specified encoding with the insertion of an ECI identifier. If a character is found that is not supported by the selected ECI encoding, an exception is thrown. Please note that some old (pre 2006) scanners may not support this mode.

◆ EDIFACT

const DataMatrixEncodeMode::EDIFACT = 10

Uses EDIFACT encoding. Uses six bits per character, encodes digits, upper-case letters, and many punctuation marks, but has no support for lower-case letters.

◆ EXTENDED

const DataMatrixEncodeMode::EXTENDED = 13

ExtendedCodetext mode allows to manually switch encodation schemes and ECI encodings in codetext. It is better to use DataMatrixExtCodetextBuilder for extended codetext generation. Use Display2DText property to set visible text to removing managing characters. ECI identifiers are set as single slash and six digits identifier "\000026" - UTF8 ECI identifier All unicode characters after ECI identifier are automatically encoded into correct character codeset.

Encodation schemes are set in the next format : "\Encodation_scheme_name:text\Encodation_scheme_name:text". Allowed encodation schemes are: EDIFACT, ANSIX12, ASCII, C40, Text, Auto.

All backslashes () must be doubled in text.

◆ EXTENDED_CODETEXT

const DataMatrixEncodeMode::EXTENDED_CODETEXT = 12

ExtendedCodetext mode allows to manually switch encodation schemes and ECI encodings in codetext.

It is better to use DataMatrixExtCodetextBuilder for extended codetext generation.

Use Display2DText property to set visible text to removing managing characters.

ECI identifiers are set as single slash and six digits identifier "\000026" - UTF8 ECI identifier

All unicode characters after ECI identifier are automatically encoded into correct character codeset.

Encodation schemes are set in the next format : "\Encodation_scheme_name:text\Encodation_scheme_name:text".

Allowed encodation schemes are: EDIFACT, ANSIX12, ASCII, C40, Text, Auto.

All backslashes () must be doubled in text.

Deprecated:
This property is obsolete and will be removed in future releases. Instead, use the 'Extended' encode mode

◆ TEXT

const DataMatrixEncodeMode::TEXT = 9

Uses Text encoding. Encodes Lower-case alphanumeric, Upper case and special characters