# Zint: Manual

## 6. Types of symbology

### 6.6 Two-Dimensional symbols

#### 6.6.1 Data Matrix (ISO 16022)

Also known as Semacode this symbology was developed in 1989 by Acuity CiMatrix in partnership with the US DoD and NASA. The symbol can encode a large amount of data in a small area. Data Matrix can encode characters in the Latin-1 set by default but also supports encoding using other character sets using the ECI mechanism. It can also encode GS1 data. The size of the generated symbol can also be adjusted using the --vers= option or by setting option_2 as shown in the table below. A separate symbology ID can be used to encode Health Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 check digit to the encoded data. Note that only ECC200 encoding is supported, the older standards have now been removed from Zint.

Input | symbol Size |
---|---|

1 | 10 x 10 |

2 | 12 x 12 |

3 | 14 x 14 |

4 | 16 x 16 |

5 | 18 x 18 |

6 | 20 x 20 |

7 | 22 x 22 |

8 | 24 x 24 |

9 | 26 x 26 |

10 | 32 x 32 |

Input | symbol Size |
---|---|

11 | 36 x 36 |

12 | 40 x 40 |

13 | 44 x 44 |

14 | 48 x 48 |

15 | 52 x 52 |

16 | 64 x 64 |

17 | 72 x 72 |

18 | 80 x 80 |

19 | 88 x 88 |

20 | 96 x 96 |

Input | symbol Size |
---|---|

21 | 104 x 104 |

22 | 120 x 120 |

23 | 132 x 132 |

24 | 144 x 144 |

25 | 8 x 18 |

26 | 8 x 32 |

27 | 12 x 26 |

28 | 12 x 36 |

29 | 16 x 36 |

30 | 16 x 48 |

When using automatic symbol sizes you can force Zint to use square symbols
(versions 1-24) at the command line by using the option --square and when
using the API by setting the value `option_3 = DM_SQUARE.`

Data Matrix Rectangular Extension (DMRE) codes, as defined in ISO/IEC 21471, may be generated with the following values as before.

Input | symbol Size |
---|---|

31 | 8 x 48 |

32 | 8 x 64 |

33 | 8 x 80 |

34 | 8 x 96 |

35 | 8 x 120 |

36 | 8 x 144 |

37 | 12 x 64 |

38 | 12 x 88 |

39 | 16 x 64 |

Input | symbol Size |
---|---|

40 | 20 x 36 |

41 | 20 x 44 |

42 | 20 x 64 |

43 | 22 x 48 |

44 | 24 x 48 |

45 | 24 x 64 |

46 | 26 x 40 |

47 | 26 x 48 |

48 | 26 x 64 |

DMRE symbol sizes may be activated in automatic mode using the option --dmre or by the API option_3 = DM_DMRE

GS1 symbology may use FNC1 (prefered) or GS as separator.
Use the option `--gssep`

to change to GS or use the API
`output_options+=GS1_GS_SEPARATOR`

#### 6.6.2 QR Code (ISO 18004)

Also known as Quick Response Code this symbology was developed by Denso. Four levels of error correction are available using the --secure= option or setting option_1 as shown in the following table.

Input | ECC Level | Error Correction Capacity | Recovery Capacity |
---|---|---|---|

1 | L (default) | Approx 20% of symbol | Approx 7% |

2 | M | Approx 37% of symbol | Approx 15% |

3 | Q | Approx 55% of symbol | Approx 25% |

4 | H | Approx 65% of symbol | Approx 30% |

The size of the symbol can be set by using the --vers= option or by setting option_2 to the QR Code version required (1-40). The size of symbol generated is shown in the table below.

Input | symbol Size |
---|---|

1 | 21 x 21 |

2 | 25 x 25 |

3 | 29 x 29 |

4 | 33 x 33 |

5 | 37 x 37 |

6 | 41 x 41 |

7 | 45 x 45 |

8 | 49 x 49 |

9 | 53 x 53 |

10 | 57 x 57 |

Input | symbol Size |
---|---|

11 | 61 x 61 |

12 | 65 x 65 |

13 | 69 x 69 |

14 | 73 x 73 |

15 | 77 x 77 |

16 | 81 x 81 |

17 | 85 x 85 |

18 | 89 x 89 |

19 | 93 x 93 |

20 | 97 x 97 |

Input | symbol Size |
---|---|

21 | 101 x 101 |

22 | 105 x 105 |

23 | 109 x 109 |

24 | 113 x 113 |

25 | 117 x 117 |

26 | 121 x 121 |

27 | 125 x 125 |

28 | 129 x 129 |

29 | 133 x 133 |

30 | 137 x 137 |

Input | symbol Size |
---|---|

31 | 141 x 141 |

32 | 145 x 145 |

33 | 149 x 149 |

34 | 153 x 153 |

35 | 157 x 157 |

36 | 161 x 161 |

37 | 165 x 165 |

38 | 169 x 169 |

39 | 173 x 173 |

40 | 177 x 177 |

The maximum capacity of a (version 40) QR Code symbol is 7089 numeric digits, 4296 alphanumeric characters or 2953 bytes of data. QR Code symbols can also be used to encode GS1 data. QR Code symbols can by default encode characters in the Latin-1 set and Kanji characters which are members of the Shift-JIS encoding scheme. In addition QR Code supports using other character sets using the ECI mechanism. Input should usually be entered as Unicode (UTF-8) with conversion to Shift-JIS being carried out by Zint. A separate symbology ID can be used to encode Health Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 check digit to the encoded data.

Non-ASCII data density may be maximized by using the --fullmultibyte switch or by setting option_3 to ZINT_FULL_MULTIBYTE, but check that your barcode reader supports this before using.

#### 6.6.3 Micro QR Code (ISO 18004)

A miniature version of the QR Code symbol for short messages. ECC levels can be selected as for QR Code (aboxve). QR Code symbols can encode characters in the Latin-1 set and Kanji characters which are members of the Shift-JIS encoding scheme. Input should be entered as a UTF-8 stream with conversion to Shift-JIS being carried out automatically by Zint. A preferred symbol size can be selected by using the --vers= option or by setting option_2 although the actual version used by Zint may be different if required by the input data. The table below shows the possible sizes:

Input | Version | symbol Size |
---|---|---|

1 | M1 | 11 x 11 |

2 | M2 | 13 x 13 |

3 | M3 | 15 x 15 |

4 | M4 | 17 x 17 |

For barcode readers that support it, non-ASCII data density may be maximized by using the --fullmultibyte switch or by setting option_3 to ZINT_FULL_MULTIBYTE.

#### 6.6.4 Rectangular Micro QR Code (rMQR)

A rectangular version of QR Code. Like QR code rMQR supports encoding of
GS-1 data, Latin-1 and Kanji characters in the Shift-JIS encoding scheme.
It does not support other ISO 8859 character sets or Unicode. As with other
symbologies data should be entered as UTF-8 with the conversion to Shift-JIS
being handled by Zint. The amount of ECC codewords can be adjusted using
`--secure=`

, however only ECC levels M and H are valid for this type of symbol.

Input | ECC Level | Error Correction Capacity | Recovery Capacity |
---|---|---|---|

2 | M | Approx 37% of symbol | Approx 15% |

4 | H | Approx 65% of symbol | Approx 30% |

The preferred symbol sizes can be selected using the --vers= option as shown in the table below. Input values between 33 and 38 fix the height of the symbol while allowing Zint to determine the minimum symbol width.

Input | Version | Symbol Size |
---|---|---|

1 | R7 x 43 | 7 x 43 |

2 | R7 x 59 | 7 x 59 |

3 | R7 x 77 | 7 x 77 |

4 | R7 x 99 | 7 x 99 |

5 | R7 x 139 | 7 x 139 |

6 | R9 x 43 | 9 x 43 |

7 | R9 x 59 | 9 x 59 |

8 | R9 x 77 | 9 x 77 |

9 | R9 x 99 | 9 x 99 |

10 | R9 x 139 | 9 x 139 |

11 | R11 x 27 | 11 x 27 |

12 | R11 x 43 | 11 x 43 |

13 | R11 x 59 | 11 x 59 |

14 | R11 x 77 | 11 x 77 |

15 | R11 x 99 | 11 x 99 |

16 | R11 x 139 | 11 x 139 |

17 | R13 x 27 | 13 x 27 |

18 | R13 x 43 | 13 x 43 |

19 | R13 x 59 | 13 x 59 |

Input | Version | Symbol Size |
---|---|---|

20 | R13 x 77 | 13 x 77 |

21 | R13 x 99 | 13 x 99 |

22 | R13 x 139 | 13 x 139 |

23 | R17 x 43 | 15 x 43 |

24 | R15 x 59 | 15 x 59 |

25 | R15 x 77 | 15 x 77 |

26 | R15 x 99 | 15 x 99 |

27 | R15 x 139 | 15 x 139 |

28 | R17 x 43 | 17 x 43 |

29 | R17 x 59 | 17 x 59 |

30 | R17 x 77 | 17 x 77 |

31 | R17 x 99 | 17 x 99 |

32 | R17 x 139 | 17 x 139 |

33 | Fixed height 7 | |

34 | Fixed height 9 | |

35 | Fixed height 11 | |

36 | Fixed height 13 | |

37 | Fixed height 15 | |

38 | Fixed height 17 |

For barcode readers that support it, non-ASCII data density may be maximized by using the --fullmultibyte switch or by setting option_3 to ZINT_FULL_MULTIBYTE.

#### 6.6.5 UPNQR - Univerzalni Plačilni Nalog QR

A variation of QR code used Združenje Bank Slovenije (Bank Association of Slovenia). The size, error correction level and ECI are set by Zint and do not need to be specified. UPNQR is unusual in that it uses ISO-8859-2 formatted data. Zint will accept UTF-8 data and convert it to ISO-8859-2, or if your data is already ISO-8859-2 formatted use the --binary switch or if using the API set

`my_symbol->input_mode=DATA_MODE;`

The following example creates a symbol from data saved in an ISO-8859-2 file:

`zint -o UPNQR.png -b 143 --border=5 --scale=3 --binary -i ./upn.txt`

#### 6.6.6 Maxicode (ISO 16023)

Developed by UPS the Maxicode symbology employs a grid of hexagons surrounding a 'bulls-eye' finder pattern. This symbology is designed for the identification of parcels. Maxicode symbols can be encoded in one of five modes. In modes 2 and 3 Maxicode symbols are composed of two parts named the primary and secondary messages. The primary message consists of a structured data field which includes various data about the package being sent and the secondary message usually consists of address data in a data structure. The format of the primary message required by Zint is given in the following table:

Characters | Meaning |
---|---|

1-9 | Postcode data which can consist of up to 9 digits (for mode 2) or up to 6 alphanumeric characters (for mode 3). Remaining unused characters should be filled with the SPACE character (ASCII 32). |

10-12 | Three digit country code according to ISO 3166. |

13-15 | Three digit service code. This depends on your parcel courier. |

The primary message can be set at the command prompt using the --primary= switch. The secondary message uses the normal data entry method. For example:

`zint -o test.eps -b 57 --primary='999999999840012' -d 'Secondary Message Here'`

When using the API the primary message must be placed in the symbol->primary string. The secondary is entered in the same way as described in section 5.2. When either of these modes is selected Zint will analyse the primary message and select either mode 2 or mode 3 as appropriate.

Modes 4 to 6 can be accessed using the --mode= switch or by setting option_1. Modes 4 to 6 do not require a primary message. For example:

`zint -o test.eps -b 57 --mode=4 -d 'A MaxiCode Message in Mode 4'`

Mode 6 is reserved for the maintenance of scanner hardware and should not be used to encode user data.

This symbology uses Latin-1 character encoding by default but also supports the ECI encoding mechanism. The maximum length of text which can be placed in a Maxicode symbol depends on the type of characters used in the text.

Example maximum data lengths are given in the table below:

Mode | Maximum Data Length for Capital Letters | Maximum Data Length for Numeric Digits | Number of Error Correction Codewords |
---|---|---|---|

2 (secondary only) | 84 | 126 | 50 |

3 (secondary only) | 84 | 126 | 50 |

4 | 93 | 135 | 50 |

5 | 77 | 110 | 66 |

6 | 93 | 135 | 50 |

#### 6.6.7 Aztec Code (ISO 24778)

Invented by Andrew Longacre at Welch Allyn Inc in 1995 the Aztec Code symbol is a matrix symbol with a distinctive bulls-eye finder pattern. Zint can generate Compact Aztec Code (sometimes called Small Aztec Code) as well as "full-range" Aztec Code symbols and by default will automatically select symbol type and size dependent on the length of the data to be encoded. Error correction codewords will normally be generated to fill at least 23% of the symbol. Two options are available to change this behaviour:

The size of the symbol can be specified using the --ver= option or setting option_2 to a value between 1 and 36 according to the following table. The symbols marked with an asterisk (*) in the table below are "compact" symbols, meaning they have a smaller bulls-eye pattern at the centre of the symbol.

Input | symbol Size |
---|---|

1 | 15 x 15* |

2 | 19 x 19* |

3 | 23 x 23* |

4 | 27 x 27* |

5 | 19 x 19 |

6 | 23 x 23 |

7 | 27 x 27 |

8 | 31 x 31 |

9 | 37 x 37 |

10 | 41 x 41 |

11 | 45 x 45 |

12 | 49 x 49 |

Input | symbol Size |
---|---|

13 | 53 x 53 |

14 | 57 x 57 |

15 | 61 x 61 |

16 | 67 x 67 |

17 | 71 x 71 |

18 | 75 x 75 |

19 | 79 x 79 |

20 | 83 x 83 |

21 | 87 x 87 |

22 | 91 x 91 |

23 | 95 x 95 |

24 | 101 x 101 |

Input | symbol Size |
---|---|

25 | 105 x 105 |

26 | 109 x 109 |

27 | 113 x 113 |

28 | 117 x 117 |

29 | 121 x 121 |

30 | 125 x 125 |

31 | 131 x 131 |

32 | 135 x 135 |

33 | 139 x 139 |

34 | 143 x 143 |

35 | 147 x 147 |

36 | 151 x 151 |

Note that in symbols which have a specified size the amount of error correction is dependent on the length of the data input and Zint will allow error correction capacities as low as 3 codewords.

Alternatively the amount of error correction data can be specified by use of the --mode= option or by setting option_1 to a value from the following table:

Mode | Error Correction Capacity |
---|---|

1 | >10% + 3 codewords |

2 | >23% + 3 codewords |

3 | >36% + 3 codewords |

4 | >50% + 3 codewords |

It is not possible to select both symbol size and error correction capacity for the same symbol. If both options are selected then the error correction capacity selection will be ignored.

Aztec Code supports ECI encoding and can encode up to a maximum length of approximately 3823 numeric or 3067 alphabetic characters or 1914 bytes of data. A separate symbology ID can be used to encode Health Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 check digit to the encoded data.

#### 6.6.8 Aztec Runes

A truncated version of compact Aztec Code for encoding whole integers between 0 and 255. Includes Reed-Solomon error correction. As defined in ISO/IEC 24778 Annex A.

#### 6.6.9 Code One

A matrix symbology developed by Ted Williams in 1992 which encodes data in a way similar to Data Matrix. Code One is able to encode the Latin-1 character set or GS1 data. There are two types of Code One symbol - variable height symbols which are roughly square (versions A thought to H) and fixed-height versions (version S and T). These can be selected by using --vers= or setting option_2 as shown in the table below:

Input | Version | Size | Numeric Data Capacity | Alphanumeric Data Capacity |
---|---|---|---|---|

1 | A | 16 x 18 | 22 | 13 |

2 | B | 22 x 22 | 44 | 27 |

3 | C | 28 x 32 | 104 | 64 |

4 | D | 40 x 42 | 217 | 135 |

5 | E | 52 x 54 | 435 | 271 |

6 | F | 70 x 76 | 886 | 553 |

7 | G | 104 x 98 | 1755 | 1096 |

8 | H | 148 x 134 | 3550 | 2218 |

9 | S | 8X height | 18 | N/A |

10 | T | 16X height | 90 | 55 |

Version S symbols can only encode numeric data. The width of version S and version T symbols is determined by the length of the input data.

#### 6.6.10 Grid Matrix

By default Grid Matrix supports encoding in Latin-1 and Chinese characters within the GB 2312 standard set to be encoded in a checkerboxard pattern. Input should be entered as a Unicode UTF-8 stream with conversion to GB 2312 being carried out automatically by Zint. The symbology also supports the ECI mechanism. The size of the symbol and the error correction capacity can be specified. If you specify both of these values then Zint will make a 'best-fit' attempt to satisfy both conditions. The symbol size can be specified using the --ver= option or by setting option_2, and the error correction capacity can be specified by using the --secure= option or by setting option_1 according to the following tables:

Input | Size |
---|---|

1 | 18 x 18 |

2 | 30 x 30 |

3 | 42 x 42 |

4 | 54 x 54 |

5 | 66 x 66 |

6 | 78 x 78 |

7 | 90x 90 |

8 | 102 x 102 |

9 | 114 x 114 |

10 | 126 x 126 |

11 | 138 x 138 |

12 | 150 x 150 |

13 | 162 x 162 |

Mode | Error Correction Capacity |
---|---|

1 | Approximately 10% |

2 | Approximately 20% |

3 | Approximately 30% |

4 | Approximately 40% |

5 | Approximately 50% |

Non-ASCII data density may be maximized by using the --fullmultibyte switch or by setting option_3 to ZINT_FULL_MULTIBYTE, but check that your barcode reader supports this before using.

#### 6.6.11 DotCode

DotCode uses a grid of dots in a rectangular formation to encode characters up to a maximum of approximately 450 characters (or 900 numeric digits). The symbology supports ECI encoding and GS-1 data encoding. By default Zint will produce a symbol which is approximately square, however the width of the symbol can be adjusted by using the --cols= option or by setting option_2. Outputting DotCode to raster images (PNG, GIF, BMP, PCX) will require setting the scale of the image to a larger value than the default (e.g. approx 10) for the dots to be plotted correctly. Approximately 33% of the resulting symbol is comprised of error correction codewords.

#### 6.6.12 Han Xin Code

Also known as Chinese Sensible Code, Han Xin is a symbology which is still under development, so it is recommended it should not yet be used for a production environment. The symbology is capable of encoding characters in the GB18030 character set (up to 4-byte characters) and is also able to support the ECI mechanism. Han Xin does not support the encoding of GS-1 data. The size of the symbol can be specified using the --ver= option or setting option_2 to a value between 1 and 84 according to the following table.

Input | symbol Size |
---|---|

1 | 23 x 23 |

2 | 25 x 25 |

3 | 27 x 27 |

4 | 29 x 29 |

5 | 31 x 31 |

6 | 33 x 33 |

7 | 35 x 35 |

8 | 37 x 37 |

9 | 39 x 39 |

10 | 41 x 41 |

11 | 43 x 43 |

12 | 45 x 45 |

13 | 47 x 47 |

14 | 49 x 49 |

Input | symbol Size |
---|---|

15 | 51 x 51 |

16 | 53 x 53 |

17 | 55 x 55 |

18 | 57 x 57 |

19 | 59 x 59 |

20 | 61 x 61 |

21 | 63 x 63 |

22 | 65 x 65 |

23 | 67 x 67 |

24 | 69 x 69 |

25 | 71 x 71 |

26 | 73 x 73 |

27 | 75 x 75 |

28 | 77 x 77 |

Input | symbol Size |
---|---|

29 | 79 x 79 |

30 | 81 x 81 |

31 | 83 x 83 |

32 | 85 x 85 |

33 | 87 x 87 |

34 | 89 x 89 |

35 | 91 x 91 |

36 | 93 x 93 |

37 | 95 x 95 |

38 | 97 x 97 |

39 | 99 x 99 |

40 | 101 x 101 |

41 | 103 x 103 |

42 | 105 x 105 |

Input | symbol Size |
---|---|

43 | 107 x 107 |

44 | 109 x 109 |

45 | 111 x 111 |

46 | 113 x 113 |

47 | 115 x 115 |

48 | 117 x 117 |

49 | 119 x 119 |

50 | 121 x 121 |

51 | 123 x 123 |

52 | 125 x 125 |

53 | 127 x 127 |

54 | 129 x 129 |

55 | 131 x 131 |

56 | 133 x 133 |

Input | symbol Size |
---|---|

57 | 135 x 135 |

58 | 137 x 137 |

59 | 139 x 139 |

60 | 141 x 141 |

61 | 143 x 143 |

62 | 145 x 145 |

63 | 147 x 147 |

64 | 149 x 149 |

65 | 151 x 151 |

66 | 153 x 153 |

67 | 155 x 155 |

68 | 157 x 157 |

69 | 159 x 159 |

70 | 161 x 161 |

Input | symbol Size |
---|---|

71 | 163 x 163 |

72 | 165 x 165 |

73 | 167 x 167 |

74 | 169 x 169 |

75 | 171 x 171 |

76 | 173 x 173 |

77 | 175 x 175 |

78 | 177 x 177 |

79 | 179 x 179 |

80 | 181 x 181 |

81 | 183 x 183 |

82 | 185 x 185 |

83 | 187 x 187 |

84 | 189 x 189 |

There are four levels of error correction capacity available for Han Xin Code which can be set by using the --mode= option or by setting option_1 to a value from the following table:

Mode | Recovery Capacity |
---|---|

1 | Approx 8% |

2 | Approx 15% |

3 | Approx 23% |

4 | Approx 30% |

It is not possible to select both symbol size and error correction capacity for the same symbol. If both options are selected then the error correction capacity selection will be ignored.

Non-ASCII data density may be maximized by using the --fullmultibyte switch or by setting option_3 to ZINT_FULL_MULTIBYTE, but check that your barcode reader supports this before using.

#### 6.6.13 Ultracode

This symbology uses a grid of coloured elements to encode data. ECI and GS-1 modes are supported. The amount of error correction can be set using the --secure= option or by setting option_1 to a value as shown in the following table:

Value | Level | Amount of symbol holding error correction data |
---|---|---|

1 | EC0 | 0% - Error detection only |

2 | EC1 | Approx 5% |

3 | EC2 | Approx 9% - Default value |

4 | EC3 | Approx 17% |

5 | EC4 | Approx 25% |

6 | EC5 | Approx 33% |

Zint does not currently implement data compression by default, but this can be initiated through the API by setting symbol->option_3 = ULTRA_COMPRESSION;

WARNING: Ultracode data compression is experimental and should not be used in a production environment.