# Two-Dimensional symbols

Click here for a condensed list of two-dimensional symbologies.

# Data Matrix ECC200 (ISO 16022)

Data Matrix ECC200

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. characters in the Latin-1 set by default but also supports encoding GS1 data or other character sets using the ECI mechanism.

Note

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

Only ECC200 encoding (opens new window) is supported.

# Data Matrix Options

The resolution of the Data Matrix can be adjusted to one of the following two options, via the DataMatrix enumerated type.

  • DM_DMRE - Resolution automatically determined (default).
  • DM_SQUARE - Square Data Matrix.

# Example

createStream({
  symbology: SymbologyType.DATAMATRIX,
  option3: DataMatrix.DM_SQUARE
}, '12345')

# Data Matrix Size

The size of the generated symbol can also be adjusted using the by setting option2 to one of the following input values:

Input Symbol Size Input Symbol Size
1 10 x 10 16 64 x 64
2 12 x 12 17 72 x 72
3 14 x 14 18 80 x 80
4 16 x 16 19 88 x 88
5 18 x 18 20 96 x 96
6 20 x 20 21 104 x 104
7 22 x 22 22 120 x 120
8 24 x 24 23 132 x 132
9 26 x 26 24 144 x 144
10 32 x 32 25 8 x 18
11 36 x 36 26 8 x 32
12 40 x 40 27 12 x 26
13 44 x 44 28 12 x 36
14 48 x 48 29 16 x 36
15 52 x 52 30 16 x 48

Tip

To force the symbol to be rendered as a square (versions 1-24), set option3 to DM_SQUARE Data Matrix option.

# Data Matrix Rectangular Extension (DMRE)

DMRE may be generated by setting option2 to one of the following values:

Input Symbol Size Input Symbol Size
31 8 x 48 35 24 x 48
32 8 x 64 36 24 x 64
33 12 x 64 37 26 x 48
34 16 x 64 38 26 x 64

Tip

DMRE symbol sizes may be activated in automatic mode by setting option3 to the DM_SQUARE Data Matrix option.

# QR Code (ISO 18004)

QR Code

Also known as Quick Response Code, this symbology was developed by Denso.

# Error correction

Four levels of error correction are available by setting option1 to one of the following input values:

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%

# Example

The following example creates a QR code:

createStream({
  symbology: SymbologyType.QRCODE,
  option2: 1
}, '12345')

# QR Code Size

The size of the symbol can be set to the QR Code version required (1-40). The size of symbol generated can be set by passing option2 to one of the following input values:

Input Symbol Size Input Symbol Size
1 21 x 21 21 101 x 101
2 25 x 25 22 105 x 105
3 29 x 29 23 109 x 109
4 33 x 33 24 113 x 113
5 37 x 37 25 117 x 117
6 41 x 41 26 121 x 121
7 45 x 45 27 125 x 125
8 49 x 49 28 129 x 129
9 53 x 53 29 133 x 133
10 57 x 57 30 137 x 137
11 61 x 61 31 141 x 141
12 65 x 65 32 145 x 145
13 69 x 69 33 149 x 149
14 73 x 73 34 153 x 153
15 77 x 77 35 157 x 157
16 81 x 81 36 161 x 161
17 85 x 85 37 165 x 165
18 89 x 89 38 169 x 169
19 93 x 93 39 173 x 173
20 97 x 97 40 177 x 177

Important

The maximum capacity of a (version 40) QR Code symbol is 7089 numeric digits (4296 alphanumeric characters, or 2953 bytes of data).

# Encoding GS1 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. QR Code also supports using other character sets using the ECI mechanism.

Note

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.

# Micro QR Code (ISO 18004)

Micro QR Code

A miniature version QR Code for short messages.

Error correction levels can be set the same way as for QR Code by setting option1.

# Mini QR Code Size

A preferred symbol size can be selected by using the option2 value to one of the following inputs:

Input Version Symbol Size
1 M1 11 x 11
2 M2 13 x 13
3 M3 15 x 15
4 M4 17 x 17

Important

The actual version used may be different if required by the input data.

# Rectangular Micro QR Code (rMQR)

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 (opens new window). It does not support other ISO/IEC 8859 (opens new window) character sets or Unicode. As with other symbologies, data should be entered as UTF-8 with the conversion to Shift-JIS being handled by the library itself.

# rMQR Codewords

The amount of ECC codewords can be adjusted the same way as for QR Code by setting option1. Note that 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%

# rMQR Size

The size of the symbol can be set by setting option2 to the QR Code version required (1-40). The size of symbol generated is shown in the table below.

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
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

# Maximizing Non-ASCII Data Density

TIP

Non-ASCII data density may be maximized by by setting option3 to 200 for barcode readers that support it.

# UPNQR - Univerzalni Plačilni Nalog QR

barcode

A variation of QR code used Združenje Bank Slovenije (Bank Association of Slovenia). The size, error correction level and ECI are automatically set and do not need to be specified.

# UPNQR Encoding

UPNQR is unusual in that it uses ISO-8859-2 (opens new window)-encoded data. Any UTF-8 data will be automatically converted to ISO-8859-2 format.

Note

If your data is already formatted as ISO-8859-2, set the encoding flag to EncodingMode.DATA_MODE.

# Example

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

createStream({
  symbology: SymbologyType.UPNQR,
  option1: 2,
  borderWidth: 5,
  scale: 3,
  encoding: EncodingMode.DATA_MODE
}, 'to je testna črtna koda')

# Maxicode (ISO 16023)

Maxicode

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 (via option1) as explained below.

# Modes 2 and 3

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 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 (opens new window).
13-15 Three digit service code. This depends on your parcel courier.

The primary message can be set via the primary option. The secondary message uses the normal data entry method.

# Example

createStream({
  symbology: SymbologyType.MAXICODE,
  option1: 2,
  primary: '999999999840012'
}, 'Secondary Message Here')

Important

The primary message must be set as the primary value.

Note

When no mode is selected, the appropriate mode will be automatically selected based on the content of the primary message.

# Modes 4, 5, and 6

Modes 4, 5, and 6 do not require a primary message.

# Example

createStream({
  symbology: SymbologyType.MAXICODE,
  option1: 4
}, 'A MaxiCode Message in Mode 4')

Note

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

# Maximum Data Lengths

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

# Aztec Code (ISO 24778)

Aztec Code

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.

Important

Depending on the length of the input data, a Compact Aztec Code (sometimes called Small Aztec Code) or a "full-range" Aztec Code may be selected.

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.

Note

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.

# Error correction

Error correction codewords will normally be generated to fill at least 23% of the symbol. Symbols which have a specified size the amount of error correction is dependent on the length of the data input. Error correction capacities as low as 3 codewords are acceptable.

There are two ways to change this behavior:

# Error correction capacity

The amount of error correction data can be specified by setting option1 to one of the following modes:

Mode Error Correction Capacity
1 >10% + 3 codewords
2 >23% + 3 codewords
3 >36% + 3 codewords
4 >50% + 3 codewords

# Symbol Size

To specify the desired size of the symbol, set option2 to one of the following input values:

Input Symbol Size Input Symbol Size
1 15 x 15* 19 79 x 79
2 19 x 19* 20 83 x 83
3 23 x 23* 21 87 x 87
4 27 x 27* 22 91 x 91
5 19 x 19 23 95 x 95
6 23 x 23 24 101 x 101
7 27 x 27 25 105 x 105
8 31 x 31 26 109 x 109
9 37 x 37 27 113 x 113
10 41 x 41 28 117 x 117
11 45 x 45 29 121 x 121
12 49 x 49 30 125 x 125
13 53 x 53 31 131 x 131
14 57 x 57 32 135 x 135
15 61 x 61 33 139 x 139
16 67 x 67 34 143 x 143
17 71 x 71 35 147 x 147
18 75 x 75 36 151 x 151

# Example

The following will render a 45x45 Aztec Code symbol with 23% error correction capacity:

createStream({
  symbology: SymbologyType.AZTEC,
  option1: 2,
  option2: 11
}, '12345')

Note

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.

Important

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 Runes

Aztec Runes

Defined in ISO/IEC 24778 (Annex A) (opens new window), a truncated version of compact Aztec Code for encoding whole integers between 0 and 255. Includes Reed-Solomon error correction (opens new window).

# Example

The following will render an Aztec Runes symbol encoding 123:

createStream({
  symbology: SymbologyType.AZRUNE
}, '123')

# Code One

Code One

A matrix symbology which encodes data in a way similar to Data Matrix ECC200. Code One is able to encode the Latin-1 character set or GS1 data.

There are two types of Code One symbols:

  • Variable height symbols, which are roughly square (versions A thought to H).
  • Fixed-height versions (version S and T).

The type can be specified by setting option2 to one of the following input values:

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

# Example

The following will render a 22x22 Code One symbol encoding An Example:

createStream({
  symbology: SymbologyType.CODEONE,
  option2: 2
}, 'An Example')

Important

  • Version S symbols can only encode numeric data.
  • The widths of version S and version T symbols are determined by the lengths of their input data.

# Grid Matrix

Grid Matrix

# Encoding

By default Grid Matrix supports encoding in Latin-1 and Chinese characters within the GB 2312 standard set (opens new window) to be encoded in a checkerboard pattern. Input should be entered as a Unicode UTF-8 stream with conversion to GB 2312 being carried out automatically. The symbology also supports the ECI mechanism.

# Error Correction and Size

There are two ways to set the error correction level:

# Error correction capacity

The error correction capacity can be specified by setting the option1 value to one of the following inputs:

Mode Error Correction Capacity
1 Approximately 10%
2 Approximately 20%
3 Approximately 30%
4 Approximately 40%
5 Approximately 50%

# Symbol Size

The symbol size can be specified by setting the option2 value to one of the following inputs:

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

# Example

The following will render a 30x30 Grid Matrix symbol with 20% error correction encoding 12345:

createStream({
  symbology: SymbologyType.GRIDMATRIX,
  option1: 2,
  option2: 2
}, '12345')

Important

If you specify both of these values, this library will make a 'best-fit' attempt to satisfy both conditions.

# DotCode

barcode

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 EncodingMode.

# Width

By default, the library will produce a symbol which is approximately square. However, the width of the symbol can be adjusted by setting option2 to the desired width (in pixels).

# Example

The following will render a DotCode symbol encoding 12345:

createStream({
  symbology: SymbologyType.DOTCODE
}, '12345')

Important

Outputting DotCode to PNG will require setting the scale of the image to a larger value than the default (~10 pixels) for the dots to be plotted correctly.

Note

Approximately 33% of the resulting symbol is comprised of error correction codewords.

# Han Xin Code

barcode

Also known as Chinese Sensible Code, this symbology is capable of encoding characters in the GB-18030 character set (opens new window) and is also able to support the ECI mechanism.

Important

Han Xin does not support the encoding of GS-1 data.

# Error Correction and Size

There are two ways to set the error correction level:

# Error correction capacity

There are four levels of error correction capacity available for Han Xin Code. To specify one, set option1 to one of the following modes:

Mode Recovery Capacity
1 Approx 8%
2 Approx 15%
3 Approx 23%
4 Approx 30%

# Symbol Size

The size of the symbol can be specified by setting option2 to one of the following input values:

Input Symbol Size Input Symbol Size
1 23 x 23 43 107 x 107
2 25 x 25 44 109 x 109
3 27 x 27 45 111 x 111
4 29 x 29 46 113 x 113
5 31 x 31 47 115 x 115
6 33 x 33 48 117 x 117
7 35 x 35 49 119 x 119
8 37 x 37 50 121 x 121
9 39 x 39 51 123 x 123
10 41 x 41 52 125 x 125
11 43 x 43 53 127 x 127
12 45 x 45 54 129 x 129
13 47 x 47 55 131 x 131
14 49 x 49 56 133 x 133
15 51 x 51 57 135 x 135
16 53 x 53 58 137 x 137
17 55 x 55 59 139 x 139
18 57 x 57 60 141 x 141
19 59 x 59 61 143 x 143
20 61 x 61 62 145 x 145
21 63 x 63 63 147 x 147
22 65 x 65 64 149 x 149
23 67 x 67 65 151 x 151
24 69 x 69 66 153 x 153
25 71 x 71 67 155 x 155
26 73 x 73 68 157 x 157
27 75 x 75 69 159 x 159
28 77 x 77 70 161 x 161
29 79 x 79 71 163 x 163
30 81 x 81 72 165 x 165
31 83 x 83 73 167 x 167
32 85 x 85 74 169 x 169
33 87 x 87 75 171 x 171
34 89 x 89 76 173 x 173
35 91 x 91 77 175 x 175
36 93 x 93 78 177 x 177
37 95 x 95 79 179 x 179
38 97 x 97 80 181 x 181
39 99 x 99 81 183 x 183
40 101 x 101 82 185 x 185
41 103 x 103 83 187 x 187
42 105 x 105 84 189 x 189

# Example

The following will render a 33x33 Han Xin symbol encoding 12345 with ~23% error correction:

createStream({
  symbology: SymbologyType.HANXIN,
  option1: 3,
  option2: 6
}, '12345')

Important

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.

# Ultracode

Ultracode

Ultracode uses a grid of coloured elements to encode data. ECI and GS-1 modes are supported.

Note

Compression is not implemented by default, but can be initiated by setting option3 to 128.

# Error correction capacity

The amount of error correction can be set by setting option1 to one of the following values:

Value Level Amount of symbol-holding error correction data
1 EC0 0% - Error detection
2 EC1 Approx 5%
3 EC2 Approx 9% (default)
4 EC3 Approx 17%
5 EC4 Approx 25%
6 EC5 Approx 33%

Warning

Ultracode is a symbology which is still under development by Zint. It is strongly advised against its use in production.