VALIDPDF417

Guide · decoding

PDF417 decoder.

A PDF417 decoder turns a printed symbol back into the byte string that produced it. Drop a PNG into the browser decoder and it runs locally with no upload; from a terminal, zbarimg --raw or zxing does the same. For an AAMVA symbol the decoded string begins with @, a line feed, 0x1E, 0x0D and ANSI .

waiting for an image

Decoding uses the zxing-js library from a CDN. The file stays in this tab. A screenshot of a barcode is usually too small to decode; use the original PNG from the API or a flat scan at 600 DPI.

How the decode works

The decoder finds the start and stop patterns, measures the row height, reconstructs the grid of codewords and reads the row indicators, which encode how many rows and columns the symbol has. It then applies the Reed-Solomon error correction codewords. Only after that does it have a byte string. Everything above the symbology, including the AAMVA header, is the decoder's second job and not every library does it.

That order matters when a symbol fails. A failure to locate the start pattern is an image or print problem. A failure during error correction is damage or a module grid that does not match. A clean decode with garbage after byte 0 is a payload problem, which is the case the inspector is built for.

Command line

bash
zbarimg --raw card.png
# or, with zxing-cpp's Python binding:
python -c "import zxingcpp, PIL.Image as I; \
print(zxingcpp.read_barcodes(I.open('card.png'))[0].bytes)"

Both print the exact bytes, including the control characters. Redirect to a file and open it in an editor that shows escapes if the terminal hides them; a payload that looks like @ANSI on screen is usually @, LF, RS, CR and ANSI .

Why photos fail and exports do not

PDF417 needs a consistent module grid: every row the same height, every column the same width, and a quiet zone on all four sides. A screenshot scaled to fit a chat window changes module widths by fractions of a pixel, which is enough to lose the row indicators before error correction can help. A perspective photo of a card adds keystoning, glare and a crop. The original PNG from an encoder is always the easier input, and a flat 600 DPI scan is the next best.

What a successful decode proves

It proves the symbol is readable and internally consistent enough for the library to recover it. It does not prove the values are true: a fabricated date of birth with a valid format decodes perfectly. It does not prove a hardware scanner at a counter will read the same print, because that scanner has its own optics, its own firmware and its own idea of the minimum module width. The conformance guide separates those layers, and the checklist covers the header once you have the string.

If the decoded string is an AAMVA payload, the fastest next step is the inspector. If it is not, the file was produced by a general PDF417 encoder and no amount of decoding will add the header.

Generate barcode now