data-matrix

The data-matrix bar code type can be used to encode text and binary data of variable length. It is possible to encode up to 1558 code words.

Text, binary data and numeric data are compressed into code words so that the limits for these types are:

  • Alphanumeric data - up to 2335 characters
  • 8-bit byte data - 1555 characters
  • Numeric data - 3116 digits

The limits for mixed text are lower, as control characters are inserted to switch between the different compression modes.

Data matrix symbols exist in several flavors with varying methods and degrees of error correction. Of the possible options ECC 000, ECC 050, ECC 080, ECC 100, ECC 140 and ECC 200 this implementation supports only ECC 200 using Reed Solomon error correction.

Special control characters like FNC1, ECI and "structured append" are currently not available.

The conversion of the data specified in the codeValue attribute to the internal representation is done by an algorithm that minimizes space. Byte values that cannot be represented in an XML document (for example all characters lower than 0x20 except 0x9, 0xa and 0xd) can be represented by a backslash ('\') character followed by a 3 digit octal literal. The backslash character itself can be escaped by a sequence of two backslash characters.

The current implementation can encode any character that exists in the code page ISO-8859-1 (Latin 1). Any attempt to encode other characters will fail. Future versions will insert ECI control characters to switch to other code pages if the character is available there.

The preferRectangularSymbols attribute is unique to this bar code type. If you are concerned about running out of space in the vertical of the page, you might prefer a symbol that is wider than it is high. This property produces a rectangular shaped symbol if the encoded data does not exceed 49 code words.