Aspose.Barcode for PHP via Java Generation and Recognition API docs
|
Public Attributes | |
const | AUTO = 0 |
const | BYTES = 1 |
const | UTF_8_BOM = 2 |
const | UTF_16_BEBOM = 3 |
const | ECI_ENCODING = 4 |
const | EXTENDED_CODETEXT = 5 |
Encoding mode for QR barcodes. It is recomended to Use AUTO with CodeTextEncoding = Encoding.UTF8 for latin symbols or digits and UTF_8_BOM for unicode symbols.
const AUTO = 0 |
Encode codetext as is non-unicode charset. If there is any unicode character, the codetext will be encoded with value which is set in CodeTextEncoding.
const BYTES = 1 |
Encode codetext as plain bytes. If it detects any unicode character, the character will be encoded as two bytes, lower byte first.
const ECI_ENCODING = 4 |
Encode codetext with value set in the ECI_ENCODING property. It can be problems with some old (pre 2006) barcode scaners. Example how to use ECI encoding
$generator = new BarcodeGenerator(EncodeTypes::QR); $generator->setCodeText("12345TEXT"); $generator->getParameters()->getBarcode()->getQR()->setQrEncodeMode(QREncodeMode::ECI_ENCODING); $generator->getParameters()->getBarcode()->getQR()->setQrEncodeType(QREncodeType::FORCE_QR); $generator->getParameters()->getBarcode()->getQR()->setQrECIEncoding(ECIEncodings::UTF8); $generator->save("test.png", "PNG");
const EXTENDED_CODETEXT = 5 |
Extended Channel mode which supports FNC1 first position, FNC1 second position and multi ECI modes. It is better to use QrExtCodetextBuilder for extended codetext generation. Use Display2DText property to set visible text to removing managing characters. Encoding Principles: All symbols "\" must be doubled "\\" in the codetext. FNC1 in first position is set in codetext as as "<FNC1>" FNC1 in second position is set in codetext as as "<FNC1(value)>". The value must be single symbols (a-z, A-Z) or digits from 0 to 99. Group Separator for FNC1 modes is set as 0x1D character '\u001D' If you need to insert "<FNC1>" string into barcode write it as "<\FNC1>" ECI identifiers are set as single slash and six digits identifier "\000026" - UTF8 ECI identifier TO disable current ECI mode and convert to default JIS8 mode zero mode ECI indetifier is set. "\000000" All unicode characters after ECI identifier are automatically encoded into correct character codeset. Example how to use FNC1 first position in Extended Mode
$textBuilder = new QrExtCodetextBuilder(); $textBuilder->addPlainCodetext("000%89%%0"); $textBuilder->addFNC1GroupSeparator(); $textBuilder->addPlainCodetext("12345<FNC1>"); //generate barcode $generator = new BarcodeGenerator(EncodeTypes::QR); $generator->setCodeText($textBuilder->getExtendedCodetext()); $generator->getParameters()->getBarcode()->getQR()->setQrEncodeMode(QREncodeMode::EXTENDED_CODETEXT); $generator->getParameters()->getBarcode()->getCodeTextParameters()->setTwoDDisplayText("My Text"); $generator->save("d:/test.png", "PNG");
This sample shows how to use FNC1 second position in Extended Mode.
//create codetext $textBuilder = new QrExtCodetextBuilder(); $textBuilder->addFNC1SecondPosition("12"); $textBuilder->addPlainCodetext("TRUE3456"); //generate barcode $generator = new BarcodeGenerator(EncodeTypes::QR); $generator->setCodeText($textBuilder->getExtendedCodetext()); $generator->getParameters()->getBarcode()->getCodeTextParameters()->setTwoDDisplayText("My Text"); $generator->save("d:/test.png", "PNG");
This sample shows how to use multi ECI mode in Extended Mode.
//create codetext $textBuilder = new QrExtCodetextBuilder(); $textBuilder->addECICodetext(ECIEncodings::Win1251, "Will"); $textBuilder->addECICodetext(ECIEncodings::UTF8, "Right"); $textBuilder->addECICodetext(ECIEncodings::UTF16BE, "Power"); $textBuilder->addPlainCodetext("t\e\\st"); //generate barcode $generator = new BarcodeGenerator(EncodeTypes::QR); $generator->setCodeText($textBuilder->getExtendedCodetext()); $generator->getParameters()->getBarcode()->getQR()->setQrEncodeMode(QREncodeMode::EXTENDED_CODETEXT); $generator->getParameters()->getBarcode()->getCodeTextParameters()->setTwoDDisplayText("My Text"); $generator->save("d:/test.png", "PNG");
const UTF_16_BEBOM = 3 |
Encode codetext with UTF8 encoding with first ByteOfMark character. It can be problems with some barcode scaners.
const UTF_8_BOM = 2 |
Encode codetext with UTF8 encoding with first ByteOfMark character.