^B7 generates a PDF417 barcode — a stacked linear barcode capable of encoding large amounts of data in a relatively compact space. PDF417 is the barcode format on US driver's licenses (AAMVA standard), airline boarding passes (BCBP standard), and many government IDs.
PDF417 can encode up to 1850 text characters or 1108 bytes of binary data. Its structure is rows of linear bar patterns stacked vertically, which is why it is sometimes called a "2D linear" barcode. It requires a 2D-capable scanner — a standard 1D laser scanner cannot read it.
The security level (s) controls error correction: levels 0–8, where 0 provides minimal error recovery and 8 provides maximum (at the cost of larger symbol size). For production labels that may be subject to damage, use security level 3–5.
The number of columns (c) and rows (r) control the symbol's aspect ratio. You can either specify both explicitly or let the printer auto-size (set c and r to 0). Auto-sizing produces the most compact symbol for the given data.
The row height (h) sets the height of each barcode row in dots. Increasing row height makes the symbol taller and easier to scan with linear scanners that may partially support PDF417, but also makes the overall symbol larger.
Syntax
^B7o,h,s,c,r,t
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| o | N | R | I | B | N | Orientation: N = normal, R = 90°, I = 180°, B = 270°. |
| h | integer | BY default | Height of each barcode row in dots. |
| s | integer (0–8) | 0 | Security level (error correction): 0 = minimum, 8 = maximum. |
| c | integer (1–30) | 0 | Number of data columns. 0 = auto. |
| r | integer (3–90) | 0 | Number of data rows. 0 = auto. |
| t | integer | 1 | Aspect ratio (truncation): 0 = truncated PDF417 (no right indicator column). |
Examples
PDF417 with auto-size and medium security
Try in Viewer^XA ^FO50,50^BY2,3,6^B7N,6,3,0,0^FDPassenger: John Smith&Flight: AA1234&Gate: B22^FS ^XZ
PDF417 encoding a large text block
Try in Viewer^XA ^FO30,30^BY2,3,5^B7N,5,2,5,10^FDLICENSE: CA98765432 DOB: 1985-03-15^FS ^XZ
Common Mistakes
- !Using a 1D scanner to read PDF417 — only 2D imaging scanners can read PDF417.
- !Setting security level too low for labels in harsh environments — a damaged symbol with security 0 may be unreadable.
- !Using PDF417 when QR Code or Data Matrix would be more compact for the same data.