^B7 - PDF417 Bar Code
Stacked two-dimensional symbology that holds several hundred bytes, used on driving licenses and shipping documents.
^B7 prints a PDF417 symbol: rows of stacked code-words, each four bars and four
spaces. One symbol holds more than a thousand characters. PDF417 carries a
document and not an identifier, and typical uses are driving licenses, boarding
passes and customs data.
^BQ and ^BX are square and small. PDF417 is wide and holds far more data. A
linear symbology needs the whole label for the same payload, and PDF417 fits.
Syntax
^B7o,h,s,c,r,tSupport
Every documented parameter renders the same output Labelary produces.
Labelary renders this command.
Parameters
oBar code orientationoptional · one of a setRotation of the symbol and interpretation line.
- Default
- the orientation set by
^FW, which itself defaults toN - Invalid value
- discarded, and the default applies. The renderer reports an unrecognized character as invalid, and uses the default.
- Test coverage
- No documented value is exercised by a test (N, R, I, B). The invalid-value rule is not pinned by a test.
N- No rotation (default)
R- Rotated 90° clockwise
I- Rotated 180°. The symbol reads upside down
B- Rotated 270° clockwise
hRow heightoptional · dotsHeight of one row of the symbol, not of the whole bar code.
- Default
- the height that makes the whole symbol match the
^BYheight - Accepted range
- 1 to the label height dots
- Invalid value
- clamped to the nearest allowed value. The renderer raises a row height of 0 to 1. The renderer reports this at render time as "Value 0 is less than minimum value 1; used 1 instead". Above the minimum there is no static bound, because the applied value depends on the number of rows the data needs.
- Test coverage
- Bounds pinned: zero (0). No test at the minimum or maximum. The invalid-value rule is not pinned by a test.
sError correction leveloptional · integerHigher levels survive more damage and make the symbol larger.
- Default
- 0
- Accepted range
- 0 to 8
- Invalid value
- clamped to the nearest allowed value. The renderer reports a level above 8, and uses the highest level that fits the chosen grid. It also reports a level that is in range but does not fit the grid, and lowers it.
- Test coverage
- Bounds pinned: above the maximum (9). No test at the minimum or maximum. The invalid-value rule is not pinned by a test.
cData columnsoptional · integerNumber of data columns. This number controls the symbol width.
- Default
- 6
- Accepted range
- 1 to 30
- Invalid value
- enough to make the whole command be ignored. The renderer discards a column count outside 1-30 and uses the default (measured against Labelary 2026-07-12).
- Test coverage
- Bounds pinned: below the minimum (0), above the maximum (40). No test at the minimum or maximum. The invalid-value rule is not pinned by a test.
rRowsoptional · integerNumber of rows. This number controls the symbol height.
- Default
- half the column count
- Accepted range
- 3 to 90
- Invalid value
- clamped to the nearest allowed value. The renderer reports a row count outside 3-90, or one too small for the data, at render time, and uses the count that fits.
- Test coverage
- Bounds pinned: above the maximum (95). No test at the minimum or maximum. The invalid-value rule is not pinned by a test.
tTruncateoptional · Y or NTruncated (compact) PDF417 drops the right row indicators. The symbol becomes narrower and less tolerant of damage.
- Default
- N
- Invalid value
- discarded, and the default applies. The renderer reports any character except
YorN, and does not truncate the symbol. - Test coverage
- Values exercised: Y. Not exercised: N. The invalid-value rule is not pinned by a test.
Y- Truncate the symbol
N- Full symbol (default)
Behavior
Shape
The symbol is three to 90 rows tall, and each row needs at least three code-words. The column argument sets the width and the row argument sets the height. Without both arguments the encoder aims for a 1:2 row-to-column ratio, and it cannot always reach that ratio exactly, because code-words do not divide evenly.
Check the constraints of the guide on that pair before a run. Rows multiplied by columns must be less than 928. No symbol prints if the product is more than 928, or if the data needs more code-words than the grid holds. Design the format against this silent failure.
The height argument is the height of one row and not of the whole symbol.
Without the argument, the row height is the ^BY bar code height divided by the
number of rows. The guide does not recommend the value 1.
Error correction and truncation
The security level runs from 0 to 8. Level 0 detects errors and corrects none, and each higher level adds correction code-words and makes the symbol larger. Truncation reduces the right row indicators and the stop pattern to a single module width, which makes the symbol narrower and less tolerant of damage. The guide advises truncation only where label damage is unlikely.
Field data
The field data holds up to 3K of characters. It covers the full ASCII set except
the characters that ZPL reserves. Write carriage return and line feed as \&,
and a literal backslash as \\, which needs ^CI13. This symbology does not
accept serialization. Use ^FM for structured append across several symbols,
because this command has no argument for it.
^BY reaches PDF417 through its module width and its height. The guide restricts
the module width to 2 to 10 dots for this symbology. The height applies only when
the row height argument is absent. The ^BY ratio has no effect.
Tested behavior
Differences from the specification
zpl.tools against the ZPL II guide
Where our renderer behaves differently from the specification.
- The guide takes the default orientation from
^FW. The renderer applies^FWto text fields only. A barcode after^FWRprints unrotated unless its ownoargument rotates it. — not pinned by a test - With no
cargument the renderer encodes 6 columns, and with norargument three rows. The guide leaves both to the encoder. A symbol from the renderer and one from a printer can differ in shape for the same data. — not pinned by a test
Example
Four data columns at security level 5, with the row count left to the encoder:
^XA
^FO50,50^BY3
^B7N,5,5,4,,N
^FDPDF417 payload 1234567890^FS
^XZ
Related commands
^BFMicroPDF417 Bar CodeCompact PDF417 variant for small labels, selected from a table of 34 fixed row-and-column layouts.^BXData Matrix Bar CodeCompact two-dimensional symbology used for small-part marking and GS1 DataMatrix.^BYBar Code Field DefaultSets the module width, wide-to-narrow ratio and height that every later bar code inherits.^FDField DataSupplies the text or barcode content of the field.