^BX
Data Matrix Bar CodePreview: partialThe compact square 2D code: a lot of data in a few millimetres, readable even when part of it is damaged.
Syntax
^BXo,h,s,c,r,f,g,aParameters
| Parameter | Description and accepted values | If omitted |
|---|---|---|
| o | Rotation of the bar code on the label.N normal, R 90°, I 180°, B 270° | Last ^FW value, else N |
| h | The size of a single module, in dots. The symbol's size follows from this and the data.1 to the label width — the size of one square module | ^BY bar height, split across the rows |
| s | Quality level. Use 200 (ECC200); the lower values are the legacy formats.0, 50, 80, 100, 140 or 200 — quality level | 0 |
| c | Column count, for a fixed symbol size.9 to 49 — columns | Chosen by the printer |
| r | Row count, for a fixed symbol size.9 to 49 — rows | Chosen by the printer |
| f | Format id, meaningful only for the legacy quality levels.1 to 6 — format id, quality 0 to 140 only | 6 |
| g | The character that introduces an escape sequence in the field data.Any character — the escape sequence character | ~ |
| a | Square or rectangular symbol.1 square, 2 rectangular | 1 |
How it works
^BX prints Data Matrix, the symbology of choice when there is very little room. A symbol a few millimetres across holds a serial number, a URL or a GS1 element string, and it stays readable when a corner is scratched away.
Quality 200 selects ECC200, the modern Reed–Solomon error correction. It is the only value worth using: the lower quality levels are the pre-1994 formats, kept for equipment that predates ECC200 and understood by almost nothing made since.
The `h` parameter is the size of one module, not the size of the symbol. The symbol grows with the data, so a longer value at the same `h` produces a bigger square — which is the usual surprise when a serial number gets one digit longer and the code no longer fits its box.
Example
^XA
^FO60,40^BXN,6,200^FDZPL Toolkit^FS
^XZRendering…
How the preview on this site handles it
Drawn with a real ECC200 encoder at the module size `h` asks for, or — when `h` is left out — at the ^BY bar height spread across the rows, as the printer sizes it. Rotation is applied. The quality level, the format id, the escape character and the aspect ratio are not read here — the preview always draws a square ECC200 symbol. Columns and rows are honoured when both are given.
Common mistakes
- Reading `h` as the symbol's height. It is the module size; the symbol is as big as the data makes it.
- Using a quality level below 200. Modern scanners are not required to read those formats, and most do not.
- Leaving no quiet zone. Data Matrix needs at least one clear module all the way round, and printing it hard against a line or a box edge is a common cause of no-reads.