TBarcode2D_HanXinCode

The component is used to create the Han Xin Code 2D barcode symbols. It's defined in the pHanXinCode unit.

Han Xin CodeHan Xin Code is also known as Chinese Sensible Code, It is a unique, variable size, matrix symbology specifically optimized for two and four byte alphabets such as Chinese and other ideographic/pictographic alphabets. It is equally suitable for single byte ISO Code Pages such as English.

Han Xin Code also includes an option for octet byte encoding for applications such as graphics and audio. Extended Channel Interpretation (ECIs) support is also included. It incorporates strong Reed-Solomon error correction to enable four levels of error correction abilities to recover information from damaged symbols.


Symbol sizes

There are eighty-four sizes of Han Xin Code symbols, referred to as version 1 to 84, in increasing order of size and data capacity. You can use the MinVersion and the MaxVersion properties to specifiy the minimum and maximum sizes for a Han Xin Code symbol. They can be one of values from 1 to 84 (defined in the pHanXin unit), corresponding to the versions 1 to 84. The smallest symbol size that accommodates the barcode text will be automatically selected between minimum and maximum symbol sizes. The CurrentVersion property can be used to get the factual symbol size.

If the barcode text does not fill the maximum data capacity of the Han Xin Code symbol, remaining data capacity of the symbol will be filled by using pad bits (the ECCLevelUpgrade property is set to false), or will be used to upgrade the error correction code level (the ECCLevelUpgrade property is set to true). If the barcode text is so long that it cannot be encoded using the maximum symbol size specified by the MaxVersion property, an OnInvalidLength or OnInvalidDataLength (only for Delphi/C++ Builder 2009 or later) event will occur.


Error correction code (ECC)

There are four user-selectable levels of error correction, from L1 to L4 respectively in increasing order of recovery capacity.

You can use the ECCLevel property to specify the error correction code level for a Han Xin Code symbol. It can be one of these values: elLevel_1, elLevel_2, elLevel_3, and elLevel_4 (they are defined in the pHanXinCode unit), corresponding to the ECC levels from L1 to L4.

These ECC levels are listed in following table:

Value of ECCLevel propertyError correction code levelRecevory capacities (%) (approx.)
elLevel_1L18%
elLevel_2L215%
elLevel_3L323%
elLevel_4L430%

If the ECCLevelUpgrade property is set to true, the highest error correction code level that can be accommodated by current symbol size will be used for creating more robust symbols. Note, the new level is always no lower than the level specified by the ECCLevel property, and the symbol size will not be increased, it may be determined depending on the length of barcode text, and the error correction code level specified by the ECCLevel property (see also the "Symbol sizes" section above). In other words, only the remaining capacity in current symbol size will be used to upgrade the error correction code level. The property CurrentECCLevel can be used to get the factual error correction code level.


Quiet zones

The minimum quiet zone is equal to 3 modules on all four sides. So the minimum values of LeadingQuietZone, TrailingQuietZone, TopQuietZone, and BottomQuietZone properties are equal to 3.


Character set

Escape sequences

If the AllowEscape property is set to true, following escape sequences are supported by the component, you can insert them to the barcode text:


Extended Channel Interpretation (ECI)

The Extended Channel Interpretation (ECI) protocol allows the output data stream to have interpretations different from that of the default character set.

The ECI protocol provides a consistent method to specify particular interpretations on byte values before printing and after decoding. The ECI is identified by an integer (up to 6 digits) which is encoded in the Han Xin Code symbol by the ECI indicator block. The escape sequence "\e[<ECI_Number>]" is used to place the ECI indicator block to the barcode text:

In a Han Xin Code symbol, the ECI indicator blocks may be placed anywhere in the barcode text. For example:

ABC\e[123]DEFabc\e[000003]def

The AllowEscape property should be set to true in order to place the ECI indicator blocks. Any ECI invoked shall apply until the end of the barcode text, or until another ECI indicator block is encountered. Thus the interpretation of the ECI may straddle two or more symbols.


Properties:
Methods:
Events:

(*): The Data property, OnInvalidDataLength and OnInvalidDataChar events are available only for the Delphi/C++ Builder 2009 or later.

Contents