VALIDPDF417

Article · 2026-11-10

How to create an AAMVA PDF417 barcode.

Three inputs decide whether a driver's license barcode scans: the element set, the jurisdiction IIN and the error correction level. Everything else is arithmetic.

1. Start from the required element list

An AAMVA DL/ID payload is a header followed by one or more subfiles. This encoder emits one DL subfile made of three-character element IDs, their values and a 0x0A terminator, closed by a 0x0D. The required set is 27 elements for every jurisdiction except New York, which adds DAH to make 28.

The six that people leave out are not optional in the standard, even though they are not printed on the card in an obvious place: DDA compliance type, DDB card revision date, DDD limited duration flag, and the three truncation flags DDE, DDF and DDG. Omitting them produces a shorter payload that still decodes, which is exactly the kind of defect a print run will not catch until a scanner refuses the card.

Fetch the schema before building a form:

bash
curl -s "https://validpdf417.com/api/v1/jurisdictions?state=CA" \
  -H "Authorization: Bearer $PDF417_KEY" | jq .required

2. Get the IIN right

The issuer identification number is six digits at header bytes 9 to 14. California is 636014; New York is 636001; Texas is 636015. The full table is on the jurisdiction index. The IIN is not the state code and cannot be derived from it.

This is the field most often copied from a sample payload. A California sample pasted into a Texas record produces a symbol that decodes cleanly and identifies the wrong issuer. Readers that validate the IIN against the jurisdiction in DAJ will reject it; readers that do not will return the wrong state's record.

3. Pick error correction for the substrate

Level 5 is the default for card stock. Level 4 suits unlaminated stock with a short print run, level 6 suits laminated or overprinted cards. Higher levels append more Reed–Solomon codewords, which makes the symbol taller, not wider. On a fixed label height that is a real constraint.

SubstrateLevelCodewords
Unlaminated card, controlled run432
Standard card stock564
Laminated or overprinted6128

The error correction page has the full 0–8 table and the decision rules for thermal, laminate and screen display.

4. Build the request

Send JSON to /api/v1/aamva. The response is a PNG by default; set format to svg for vector output. The body below is a complete California record.

bash
curl -s https://validpdf417.com/api/v1/aamva \
  -H "Authorization: Bearer $PDF417_KEY" \
  -H "Content-Type: application/json" \
  -d '{"state":"CA","eclevel":5,"format":"png","dpi":600,"fields":{
       "DAQ":"A1234567","DCS":"SAMPLE","DAC":"JORDAN","DBB":"19900314",
       "DBA":"20300115","DBC":"1","DAG":"1234 SAMPLE ST","DAI":"BEVERLY HILLS",
       "DAK":"90210","DCF":"DD123456789012","DCK":"123456789012",
       "DCA":"C","DCB":"NONE","DCD":"NONE","DDA":"F","DDB":"20200101",
       "DDD":"1","DDE":"N","DDF":"N","DDG":"N"}}' -o dl.png

5. Compute the header, do not template it

The header is 31 bytes: @, 0x0A, 0x1E, 0x0D, ANSI , the IIN, AAMVA version 10, jurisdiction version 00, entry count 01, then the subfile directory entry DL with a four-digit offset and a four-digit length. The offset counts from the first byte of the file. The length counts the subfile's two-byte designator, its elements and the closing 0x0D. The designator appears at the offset, but the offset and length digits do not.

Repeating the directory entry inside the subfile is the classic error. The symbol renders, the checksum passes, and the read of the first element begins with DL0 instead of DAQ. The byte layout reference walks the arithmetic line by line.

6. Decode before you print

One decode catches more than an hour of staring at a form. Use zbarimg --raw and check that byte 0 is 0x40 and bytes 1 to 3 are 0x0A 0x1E 0x0D. Then re-check the subfile offset against the actual position of DL, and the length against the remaining bytes.

If you would rather not install a decoder, the browser decoder reads a PNG locally and the inspector checks a pasted payload. Neither sends the payload anywhere.

Checklist

  • Every required element present, including the six flags.
  • IIN matches the jurisdiction in DAJ.
  • Offset equals the byte position of the subfile designator.
  • Length equals the designator plus the elements plus the closing 0x0D.
  • EC level matches the substrate, not the default.
  • Decoded once at native size before the batch runs.
Generate barcode now