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

Public Attributes

const AUTO = 0
 
const BINARY = 1
 
const ECI = 2
 
const UNICODE = 3
 
const URI = 4
 
const EXTENDED = 5
 

Detailed Description

Han Xin Code encoding mode. It is recommended to use Auto with ASCII / Chinese characters or Unicode for Unicode characters.


 
 // Auto mode
 $codetext = "1234567890ABCDEFGabcdefg,Han Xin Code";
 $generator = new BarcodeGenerator(EncodeTypes::HAN_XIN, codetext);
 $generator->save("test.bmp", BarcodeImageFormat::BMP);

 // Bytes mode
 $encodedArr = array(0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9);

 //encode array to string
 StringBuilder strBld = new StringBuilder();
 for (byte bval : encodedArr)
     strBld.append((char) bval);
 $codetext = strBld.toString();

 $generator = new BarcodeGenerator(EncodeTypes::HAN_XIN, codetext);
 $generator->getParameters()->getBarcode()->getHanXin()->setHanXinEncodeMode(HanXinEncodeMode::BYTES);
 $generator->save("test.bmp", BarcodeImageFormat::BMP);

 // ECI mode
 $codetext = "ΑΒΓΔΕ";
 $generator = new BarcodeGenerator(EncodeTypes::HAN_XIN, codetext);
 $generator->getParameters()->getBarcode()->getHanXin()->setHanXinEncodeMode(HanXinEncodeMode::ECI);
 $generator->getParameters()->getBarcode()->getHanXin()->setHanXinECIEncoding(ECIEncodings::ISO_8859_7);
 $generator->save("test.bmp", BarcodeImageFormat::BMP);

 // URI mode
 $codetext = "https://www.test.com/%BC%DE%%%ab/search=test";
 $generator = new BarcodeGenerator(EncodeTypes::HAN_XIN, codetext);
 $generator->getParameters()->getBarcode()->getHanXin()->setHanXinEncodeMode(HanXinEncodeMode::URI);
 $generator->save("test.bmp", BarcodeImageFormat::BMP);

 // Extended mode - TBD
 

Member Data Documentation

◆ AUTO

const HanXinEncodeMode::AUTO = 0

Sequence of Numeric, Text, ECI, Binary Bytes and 4 GB18030 modes changing automatically.

◆ BINARY

const HanXinEncodeMode::BINARY = 1

Binary byte mode encodes binary data in any form and encodes them in their binary byte. Every byte in Binary Byte mode is represented by 8 bits.

◆ ECI

const HanXinEncodeMode::ECI = 2

Extended Channel Interpretation (ECI) mode

◆ EXTENDED

const HanXinEncodeMode::EXTENDED = 5

Extended mode will allow more flexible combinations of other modes, this mode is currently not implemented.

◆ UNICODE

const HanXinEncodeMode::UNICODE = 3

Unicode mode designs a way to represent any text data reference to UTF8 encoding/charset in Han Xin Code.

◆ URI

const HanXinEncodeMode::URI = 4

URI mode indicates the data represented in Han Xin Code is Uniform Resource Identifier (URI) reference to RFC 3986.