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

Public Attributes

const AUTO = 0
 
const BYTES = 1
 
const EXTENDED_CODETEXT = 2
 

Detailed Description

Encoding mode for Aztec barcodes.



//Auto mode
$codetext = "犬Right狗";
$generator = new BarcodeGenerator(EncodeTypes::AZTEC, $codetext);
$generator->getParameters()->getBarcode()->getAztec()->setECIEncoding(ECIEncodings::UTF_8);
$generator->save("test.bmp", BarcodeImageFormat::BMP);
@code
//Bytes mode
$encodedArr = [0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9];
//encode array to string
$strBld = "";
foreach($encodedArr as bval)
$strBld->append(chr(bval));
$codetext = $strBld->toString();
$generator = new BarcodeGenerator(EncodeTypes::AZTEC, $codetext);
$generator->getParameters()->getBarcode()->getAztec()->setAztecEncodeMode(AztecEncodeMode::BYTES);
$generator->save("test.bmp", BarcodeImageFormat::BMP);
@code
//Extended codetext mode
//create codetext
$textBuilder = new AztecExtCodetextBuilder();
$textBuilder->addECICodetext(ECIEncodings::Win1251, "Will");
$textBuilder->addECICodetext(ECIEncodings::UTF8, "犬Right狗");
$textBuilder->addECICodetext(ECIEncodings::UTF16BE, "犬Power狗");
$textBuilder->addPlainCodetext("Plain text");
//generate codetext
$codetext = $textBuilder->getExtendedCodetext();
//generate
$generator = new BarcodeGenerator(EncodeTypes::AZTEC, codetext);
$generator->getParameters()->getBarcode()->getAztec()->setAztecEncodeMode(AztecEncodeMode::EXTENDED_CODETEXT);
$generator->getParameters()->getBarcode()->getCodeTextParameters()->setTwoDDisplayText("My Text");
$generator->save("test.bmp", BarcodeImageFormat::BMP);
</pre>
</pre></blockquote></hr></p>

Member Data Documentation

◆ AUTO

const AztecEncodeMode::AUTO = 0

Encode codetext with value set in the ECIEncoding property.

◆ BYTES

const AztecEncodeMode::BYTES = 1

Encode codetext as plain bytes. If it detects any Unicode character, the character will be encoded as two bytes, lower byte first.

◆ EXTENDED_CODETEXT

const AztecEncodeMode::EXTENDED_CODETEXT = 2

Extended mode which supports multi ECI modes.

It is better to use AztecExtCodetextBuilder 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.