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

Public Attributes

const AUTO = 0
 
const BYTES = 1
 
const EXTENDED_CODETEXT = 2
 
const BINARY = 3
 
const ECI = 4
 
const EXTENDED = 5
 

Detailed Description

Extended codetext generator for Aztec barcodes for ExtendedCodetext Mode of AztecEncodeMode

Use TwoDDisplayText property of BarcodeGenerator to set visible text to removing managing characters.


   This sample shows how to use AztecExtCodetextBuilder in Extended 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()->getCodeTextParameters()->setwoDDisplayText("My Text");
$generator->save("test.bmp", BarcodeImageFormat::BMP);
*/
class AztecExtCodetextBuilder extends ExtCodetextBuilder
{
private const JAVA_CLASS_NAME = "com.aspose.mw.barcode.generation.MwAztecExtCodetextBuilder";
public function __construct()
{
try {
$java_class = new java(self::JAVA_CLASS_NAME);
parent::__construct($java_class);
} catch (Exception $ex) {
throw new BarcodeException($ex->getMessage(), __FILE__, __LINE__);
}
}
public function init() : void
{
}
/**
<p>
Generates Extended codetext from the extended codetext list.
</p>
@return Extended codetext as string
*/
public function getExtendedCodetext() : string
{
return $this->getJavaClass()->getExtendedCodetext();
}
}
/**
Extended Channel Interpretation Identifiers. It is used to tell the barcode reader details
about the used references for encoding the data in the symbol.
Example how to use ECI encoding
@code
$generator = new BarcodeGenerator(EncodeTypes::QR);
$generator->setCodeText("12345TEXT");
$generator->getParameters()->getBarcode()->getQR()->setQrEncodeMode(QREncodeMode::ECI_ENCODING);
$generator->getParameters()->getBarcode()->getQR()->setQrECIEncoding(ECIEncodings::UTF_8);
$generator->save("test.png", "PNG");
*/ class ECIEncodings { /** ISO/IEC 8859-1 Latin alphabet No. 1 encoding. ECI Id:"\000003" */ const ISO_8859_1 = 3; /** ISO/IEC 8859-2 Latin alphabet No. 2 encoding. ECI Id:"\000004" */ const ISO_8859_2 = 4; /** ISO/IEC 8859-3 Latin alphabet No. 3 encoding. ECI Id:"\000005" */ const ISO_8859_3 = 5; /** ISO/IEC 8859-4 Latin alphabet No. 4 encoding. ECI Id:"\000006" */ const ISO_8859_4 = 6; /** ISO/IEC 8859-5 Latin/Cyrillic alphabet encoding. ECI Id:"\000007" */ const ISO_8859_5 = 7; /** ISO/IEC 8859-6 Latin/Arabic alphabet encoding. ECI Id:"\000008" */ const ISO_8859_6 = 8; /** ISO/IEC 8859-7 Latin/Greek alphabet encoding. ECI Id:"\000009" */ const ISO_8859_7 = 9; /** ISO/IEC 8859-8 Latin/Hebrew alphabet encoding. ECI Id:"\000010" */ const ISO_8859_8 = 10; /** ISO/IEC 8859-9 Latin alphabet No. 5 encoding. ECI Id:"\000011" */ const ISO_8859_9 = 11; /** ISO/IEC 8859-10 Latin alphabet No. 6 encoding. ECI Id:"\000012" */ const ISO_8859_10 = 12; /** ISO/IEC 8859-11 Latin/Thai alphabet encoding. ECI Id:"\000013" */ const ISO_8859_11 = 13; //14 is reserved /** ISO/IEC 8859-13 Latin alphabet No. 7 (Baltic Rim) encoding. ECI Id:"\000015" */ const ISO_8859_13 = 15; /** ISO/IEC 8859-14 Latin alphabet No. 8 (Celtic) encoding. ECI Id:"\000016" */ const ISO_8859_14 = 16; /** ISO/IEC 8859-15 Latin alphabet No. 9 encoding. ECI Id:"\000017" */ const ISO_8859_15 = 17; /** ISO/IEC 8859-16 Latin alphabet No. 10 encoding. ECI Id:"\000018" */ const ISO_8859_16 = 18; //19 is reserved /** Shift JIS (JIS X 0208 Annex 1 + JIS X 0201) encoding. ECI Id:"\000020" */ const Shift_JIS = 20; // /** Windows 1250 Latin 2 (Central Europe) encoding. ECI Id:"\000021" */ const Win1250 = 21; /** Windows 1251 Cyrillic encoding. ECI Id:"\000022" */ const Win1251 = 22; /** Windows 1252 Latin 1 encoding. ECI Id:"\000023" */ const Win1252 = 23; /** Windows 1256 Arabic encoding. ECI Id:"\000024" */ const Win1256 = 24; // /** ISO/IEC 10646 UCS-2 (High order byte first) encoding. ECI Id:"\000025" */ const UTF16BE = 25; /** ISO/IEC 10646 UTF-8 encoding. ECI Id:"\000026" */ const UTF8 = 26; // /** ISO/IEC 646:1991 International Reference Version of ISO 7-bit coded character set encoding. ECI Id:"\000027" */ const US_ASCII = 27; /** Big 5 (Taiwan) Chinese Character Set encoding. ECI Id:"\000028" */ const Big5 = 28; /**
GB2312 Chinese Character Set encoding. ECI Id:"\000029"
     */
    const GB2312 = 29;
    /**
       Korean Character Set encoding. ECI Id:"\000030"
     */
    const EUC_KR = 30;
    /**
       
GBK (extension of GB2312 for Simplified Chinese)  encoding. ECI Id:"\000031"
     */
    const GBK = 31;
    /**
       
GGB18030 Chinese Character Set encoding. ECI Id:"\000032"
     */
    const GB18030 = 32;
    /**
       
 ISO/IEC 10646 UTF-16LE encoding. ECI Id:"\000033"
     */
    const UTF16LE = 33;
    /**
       
 ISO/IEC 10646 UTF-32BE encoding. ECI Id:"\000034"
     */
    const UTF32BE = 34;
    /**
       
 ISO/IEC 10646 UTF-32LE encoding. ECI Id:"\000035"
     */
    const UTF32LE = 35;
    /**
       
 ISO/IEC 646: ISO 7-bit coded character set - Invariant Characters set encoding. ECI Id:"\000170"
     */
    const INVARIANT = 170;
    /**
       
 8-bit binary data. ECI Id:"\000899"
     */
    const BINARY = 899;

    /**
       No Extended Channel Interpretation/p>
     */
    const NONE = 0;
}

/**
   Enable checksum during generation for 1D barcodes.
   Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible.
   Checksum never used: Codabar
   Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN
   Checksum always used: Rest symbologies
 */
class EnableChecksum
{
    /**
       If checksum is required by the specification - it will be attached.
     */
    const DEFAULT = 0;

    /**
       Always use checksum if possible.
     */
    const YES = 1;

    /**
       Do not use checksum.
     */
    const NO = 2;
}

/**
   Specifies the file format of the image.
 */
class BarCodeImageFormat
{
    /**
       Specifies the bitmap (BMP) image format.
     */
    const BMP = 0;

    /**
       Specifies the Graphics Interchange Format (GIF) image format.
     */
    const GIF = 1;

    /**
       Specifies the Joint Photographic Experts Group (JPEG) image format.
     */
    const JPEG = 2;

    /**
       Specifies the W3C Portable Network Graphics (PNG) image format.
     */
    const PNG = 3;

    /**
       Specifies the Tagged Image File Format (TIFF) image format.
     */
     const TIFF = 4;


    /**
       Specifies the Tagged Image File Format (TIFF) image format in CMYK color model.
     */
     const TIFF_IN_CMYK = 5;

    /**
       Specifies the Enhanced Metafile (EMF) image format.
     */
     const EMF = 6;

    /**
       Specifies the Scalable Vector Graphics (SVG) image format.
     */
     const SVG = 7;
}


/**
   Type of 2D component
   This sample shows how to create and save a GS1 Composite Bar image.
   Note that 1D codetext and 2D codetext are separated by symbol '/'
$codetext = "(01)03212345678906/(21)A1B2C3D4E5F6G7H8";
$generator = new BarcodeGenerator(EncodeTypes::GS1_COMPOSITE_BAR, $codetext))
$generator->getParameters()->getBarcode()->getGS1CompositeBar()->setLinearComponentType(EncodeTypes::GS1_CODE_128);
$generator->getParameters()->getBarcode()->getGS1CompositeBar()->setTwoDComponentType(TwoDComponentType::CC_A);
// Aspect ratio of 2D component
$generator->getParameters()->getBarcode()->getPdf417()->setAspectRatio(3);
///
// X-Dimension of 1D and 2D components
$generator->getParameters()->getBarcode()->getXDimension()->setPixels(3);
///
// Height of 1D component
$generator->getParameters()->getBarcode()->getBarHeight()->setPixels(100);
///
$generator->save("test.png", BarcodeImageFormat::PNG);
*/ class TwoDComponentType { /** Auto select type of 2D component */ const AUTO = 0; /** CC-A type of 2D component. It is a structural variant of MicroPDF417 */ const CC_A = 1; /** CC-B type of 2D component. It is a MicroPDF417 symbol. */ const CC_B = 2; /** CC-C type of 2D component. It is a PDF417 symbol. */ const CC_C = 3; } /** Used to tell the encoder whether to add Macro PDF417 Terminator (codeword 922) to the segment. Applied only for Macro PDF417. */ class Pdf417MacroTerminator { /** The terminator will be added automatically if the number of segments is provided and the current segment is the last one. In other cases, the terminator will not be added. */ const AUTO = 0; /** The terminator will not be added. */ const NONE = 1; /** The terminator will be added. */ const SET = 2; } /** Encoding mode for MaxiCode barcodes.
//Auto mode
$codetext = "犬Right狗";
$generator = new BarcodeGenerator(EncodeTypes::MAXI_CODE, $codetext))
$generator->getParameters()->getBarcode()->getMaxiCode()->setECIEncoding(ECIEncodings::UTF8);
$generator->save("test.bmp");
//Bytes mode
$encodedArr = array( 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9 );
//encode array to String
$strBld = "";
foreach($encodedArr as $bval)
{
$strBld .= $bval;
}
$codetext = $strBld;
$generator = new BarcodeGenerator(EncodeTypes::MAXI_CODE, $codetext);
$generator->getParameters()->getBarcode()->getMaxiCode()->setMaxiCodeEncodeMode(MaxiCodeEncodeMode.BYTES);
$generator->save(ApiTests::folder."test2.bmp", BarCodeImageFormat::BMP);
*/ class MaxiCodeEncodeMode { /**
       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.
       
     */
    const AUTO = 0;

    /**
       Encode codetext as plain bytes. If it detects any Unicode character, the character will be encoded as two bytes, lower byte first.
 
Deprecated:
*/ const BYTES = 1;
    /**
       
       
Extended mode which supports multi ECI modes.
       
It is better to use MaxiCodeExtCodetextBuilder 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.
       
 
Deprecated:
*/ const EXTENDED_CODETEXT = 2;
    /**
       Extended mode which supports multi ECI modes.
       It is better to use MaxiCodeExtCodetextBuilder 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.
     */
    const EXTENDED = 3;
    /**
       
       In Binary mode, the CodeText is encoded with maximum data compactness.
       If a Unicode character is found, an exception is thrown.
        
     */
     const BINARY = 4;
    /**
       
       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.
       
     */
    const ECI = 5;
}
/**
   Encoding mode for MaxiCode barcodes.
   This sample shows how to genereate MaxiCode barcodes using ComplexBarcodeGenerator
//Mode 2 with standart second message
$maxiCodeCodetext = new MaxiCodeCodetextMode2();
$maxiCodeCodetext->setPostalCode("524032140");
$maxiCodeCodetext->setCountryCode(056);
$maxiCodeCodetext->setServiceCategory(999);
maxiCodeStandartSecondMessage = new MaxiCodeStandartSecondMessage();
$maxiCodeStandartSecondMessage->setMessage("Test message");
$maxiCodeCodetext->setSecondMessage($maxiCodeStandartSecondMessage);
$complexGenerator = new ComplexBarcodeGenerator($maxiCodeCodetext);
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
//Mode 2 with structured second message
$maxiCodeCodetext = new MaxiCodeCodetextMode2();
$maxiCodeCodetext->setPostalCode("524032140");
$maxiCodeCodetext->setCountryCode(056);
$maxiCodeCodetext->setServiceCategory(999);
maxiCodeStructuredSecondMessage = new MaxiCodeStructuredSecondMessage();
$maxiCodeStructuredSecondMessage->add("634 ALPHA DRIVE");
$maxiCodeStructuredSecondMessage->add("PITTSBURGH");
$maxiCodeStructuredSecondMessage->add("PA");
$maxiCodeStructuredSecondMessage->setYear(99);
$maxiCodeCodetext->setSecondMessage($maxiCodeStructuredSecondMessage);
$complexGenerator = new ComplexBarcodeGenerator($maxiCodeCodetext);
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
//Mode 3 with standart second message
$maxiCodeCodetext = new MaxiCodeCodetextMode3();
$maxiCodeCodetext->setPostalCode("B1050");
$maxiCodeCodetext->setCountryCode(056);
$maxiCodeCodetext->setServiceCategory(999);
$maxiCodeStandartSecondMessage = new MaxiCodeStandartSecondMessage();
$maxiCodeStandartSecondMessage->setMessage("Test message");
$maxiCodeCodetext->setSecondMessage($maxiCodeStandartSecondMessage);
$complexGenerator = new ComplexBarcodeGenerator($maxiCodeCodetext);
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
//Mode 3 with structured second message
$maxiCodeCodetext = new MaxiCodeCodetextMode3();
$maxiCodeCodetext->setPostalCode("B1050");
$maxiCodeCodetext->setCountryCode(056);
$maxiCodeCodetext->setServiceCategory(999);
$maxiCodeStructuredSecondMessage = new MaxiCodeStructuredSecondMessage();
$maxiCodeStructuredSecondMessage->add("634 ALPHA DRIVE");
$maxiCodeStructuredSecondMessage->add("PITTSBURGH");
$maxiCodeStructuredSecondMessage->add("PA");
$maxiCodeStructuredSecondMessage->setYear(99);
$maxiCodeCodetext->setSecondMessage($maxiCodeStructuredSecondMessage);
$complexGenerator = new ComplexBarcodeGenerator($maxiCodeCodetext->getConstructedCodetext();
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
//Mode 4
$maxiCodeCodetext = new MaxiCodeStandardCodetext();
$maxiCodeCodetext->setMode(MaxiCodeMode::MODE_4);
$maxiCodeCodetext->setMessage("Test message");
$complexGenerator = new ComplexBarcodeGenerator($maxiCodeCodetext->getConstructedCodetext();
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
//Mode 5
$maxiCodeCodetext = new MaxiCodeStandardCodetext();
$maxiCodeCodetext->setMode(MaxiCodeMode::MODE_5);
$maxiCodeCodetext->setMessage("Test message");
$complexGenerator = new ComplexBarcodeGenerator($maxiCodeCodetext->getConstructedCodetext())
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
//Mode 6
$maxiCodeCodetext = new MaxiCodeStandardCodetext();
$maxiCodeCodetext->setMode(MaxiCodeMode::MODE_6);
$maxiCodeCodetext->setMessage("Test message");
$complexGenerator = new ComplexBarcodeGenerator($maxiCodeCodetext->getConstructedCodetext();
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
*/ class MaxiCodeMode { /** Mode 2 encodes postal information in first message and data in second message. Has 9 digits postal code (used only in USA). */ const MODE_2 = 2;
    /**
       Mode 3 encodes postal information in first message and data in second message.
       Has 6 alphanumeric postal code, used in the world.
     */
    const MODE_3 = 3;
    /**
        Mode 4 encodes data in first and second message, with short ECC correction.
     */
    const MODE_4 = 4;
    /**
       Mode 5 encodes data in first and second message, with long ECC correction.
     */
    const MODE_5 = 5;
    /**
       Mode 6 encodes data in first and second message, with short ECC correction.
       Used to encode device.
     */
    const MODE_6 = 6;
}
/**
   
   Encoding mode for DotCode barcodes.
   

   
   //Auto mode with macros
   $codetext = ""[)>\u001E05\u001DCodetextWithMacros05\u001E\u0004"";
   $generator = new BarcodeGenerator(EncodeTypes::DOT_CODE, $codetext);
   $generator->save("test.bmp", BarCodeImageFormat::BMP);

   //Auto mode
   $codetext = "犬Right狗";
   $generator = new BarcodeGenerator(EncodeTypes::DOT_CODE, $codetext);
   $generator->getParameters()->getBarcode()->getDotCode()->setECIEncoding(ECIEncodings::UTF8);
   $generator->save("test.bmp", BarCodeImageFormat::BMP);

   //Bytes mode
   $encodedArr = array(0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9);
   $generator = new BarcodeGenerator(EncodeTypes::DOT_CODE, null);
   $generator->setCodetext($encodedArr, null);
   $generator->getParameters()->getBarcode()->getDotCode()->setDotCodeEncodeMode(DotCodeEncodeMode::BINARY);
   $generator->save("test.bmp", BarcodeImageFormat:PNG);

   //Extended codetext mode
   //create codetext
   $textBuilder = new DotCodeExtCodetextBuilder();
   $textBuilder->addFNC1FormatIdentifier();
   $textBuilder->addECICodetext(ECIEncodings::Win1251, "Will");
   $textBuilder->addFNC1FormatIdentifier();
   $textBuilder->addECICodetext(ECIEncodings::UTF8, "犬Right狗");
   $textBuilder->addFNC3SymbolSeparator();
   $textBuilder->addFNC1FormatIdentifier();
   $textBuilder->addECICodetext(ECIEncodings::UTF16BE, "犬Power狗");
   $textBuilder->addPlainCodetext("Plain text");
   //generate codetext
   $codetext = $textBuilder->getExtended();
   //generate
   $generator = new BarcodeGenerator(EncodeTypes::DOT_CODE, $codetext);
   $generator->getParameters()->getBarcode()->getDotCode()->setDotCodeEncodeMode(DotCodeEncodeMode::EXTENDED_CODETEXT);
   $generator->save("test.bmp", BarCodeImageFormat::BMP);
   

Member Data Documentation

◆ AUTO

const DotCodeEncodeMode::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.

◆ BINARY

const DotCodeEncodeMode::BINARY = 3

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

◆ BYTES

const DotCodeEncodeMode::BYTES = 1

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

Deprecated:

◆ ECI

const DotCodeEncodeMode::ECI = 4

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.

◆ EXTENDED

const DotCodeEncodeMode::EXTENDED = 5

Extended mode which supports multi ECI modes.

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

◆ EXTENDED_CODETEXT

const DotCodeEncodeMode::EXTENDED_CODETEXT = 2

Extended mode which supports multi ECI modes.

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

Deprecated: