Passer au contenu

PDF417 barcodes in ZPL with ^B7

To print a PDF417 barcode in ZPL, set the module width with ^BY and use ^B7N with the row height and the security level: ^BY2^FO40,40^B7N,6,3,,,N^FDOpenZPL PDF417 sample^FS. PDF417 stacks rows of code words, so it holds much more than a linear barcode in a wide, short block.

Mis à jour le 2026-10-20 · Renders made with the OpenZPL engine

Open in the viewer

Generator

Rendu…

4 × 2 in label at 203 dpi. A preview shows how the printer draws the code; confirm with a scanner before printing a run.

The ^B7 command

ParamètreCe que cela faitValeurs
^BY wModule width, in dots2 or 3 at 203 dpi
^B7 oOrientationN, R, I, B
^B7 hHeight of each row, in dotsfor example 6 to 10
^B7 sSecurity (error correction) level0 to 8
^B7 cData columns1 to 30; empty = the printer chooses
^B7 rRows3 to 90; empty = the printer chooses
^B7 tTruncate the right sideN (standard) or Y (compact)
PDF417 barcode, 240 by 60 dots, encoding OpenZPL PDF417 sample
4 × 2 in label at 203 dpi (8 dpmm) · 812 × 406 px · Open in the viewer
^XA
^BY2
^FO40,40^B7N,6,3,,,N
^FDOpenZPL PDF417 sample^FS
^XZ

Size in dots

The same 21-character text, rendered by the OpenZPL engine at 203 dpi:

SettingsSize in dots
^BY2, ^B7N,6,3,,,N240 × 60
^BY2, 4 columns274 × 48
^BY2, truncated (t = Y)172 × 60
^BY3, ^B7N,10,5,,,N462 × 160

More columns make the code wider and shorter; a higher security level adds code words and makes it bigger. Truncated PDF417 saves width but some scanners don't accept it, so prefer the standard form unless space forces you.

^BY2, rows of 6 dots, security 3

PDF417 barcode, 240 by 60 dots, encoding OpenZPL PDF417 sample
4 × 2 in label at 203 dpi (8 dpmm) · 812 × 406 px · Open in the viewer
^XA
^BY2
^FO40,40^B7N,6,3,,,N
^FDOpenZPL PDF417 sample^FS
^XZ

^BY3, rows of 10 dots, security 5

The same PDF417 with module width 3, taller rows and security level 5
4 × 2 in label at 203 dpi (8 dpmm) · 812 × 406 px · Open in the viewer
^XA
^BY3
^FO40,40^B7N,10,5,,,N
^FDOpenZPL PDF417 sample^FS
^XZ

Valid and invalid data

  • Text and digits of any kind; PDF417 is used on IDs, boarding passes and shipping documents.
  • Escape ^ and ~ with ^FH, as in every field.
  • Very long data makes a code taller than the label; raise the column count to keep it short.

Check a barcode before printing a run

A preview shows how the printer will draw the code: bar widths, quiet zone and the human-readable line. It does not prove that every scanner reads it on your media. Print one label at the real density and scan it with the scanner your customer or carrier uses; for retail and logistics codes, a barcode verifier grades the print quality.

Questions

What is the difference between ^B7 and MicroPDF417?

MicroPDF417 (^BF) is a smaller variant for short data. The OpenZPL engine doesn't draw ^BF yet; see compatibility.

Why is my PDF417 too tall?

Lower the row height (second parameter of ^B7) or set more columns so the data spreads sideways.

Sources