PDF417: многоуровневый штрихкод на водительском удостоверении
How PDF417 works: row-based structure, macro mode for large data, error correction levels, and its role in ID cards, boarding passes, and shipping.
PDF417: The Stacked Barcode on Your Driver's License
PDF417 (Portable Data File, 4 bars, 1-7 units) is a stacked linear barcode defined by ISO/IEC 15438. It appears on driver's licenses, government IDs, boarding passes, shipping labels, and anywhere substantial data must be encoded in a printable format.
Structure
PDF417 is not a true matrix code but a stack of linear barcode rows. Each row contains:
- A start pattern (fixed)
- A left row indicator (encodes row number and EC level)
- 1-30 data codewords
- A right row indicator
- A stop pattern (fixed)
The number of rows ranges from 3 to 90, and each codeword consists of 4 bars and 4 spaces within 17 modules.
Data Capacity
PDF417 can encode: - Numeric: Up to 2,710 digits - Alphanumeric: Up to 1,850 characters - Binary: Up to 1,108 bytes
Practical symbols typically encode 100-500 characters.
Compaction Modes
PDF417 uses three compaction modes to maximize density:
- Text Compaction: ~2 characters per codeword for letters and digits
- Byte Compaction: ~1.2 bytes per codeword for binary data
- Numeric Compaction: ~2.9 digits per codeword for numeric strings
The encoder switches modes as needed within a single symbol.
Error Correction
PDF417 uses Reed-Solomon error correction with 9 configurable security levels (0-8). Each level adds error correction codewords:
| Level | EC Codewords | Recommended Data Range |
|---|---|---|
| 0 | 2 | 1-40 codewords |
| 1 | 4 | 41-160 |
| 2 | 8 | 161-320 |
| 3 | 16 | 321-863 |
| 5 | 64 | Large documents |
Most applications use level 2-5.
Macro PDF417
For very large data that exceeds a single symbol, Macro PDF417 links multiple symbols through a file ID and segment index. The decoder reassembles the complete data from all segments.
Micro PDF417
A compact variant with fewer rows, smaller overhead, and a different row indicator scheme. It encodes up to 150 bytes in a smaller footprint, suitable for component labels and small packages.
Applications
- Driver's licenses: AAMVA standard encodes name, address, DOB, and license data
- Airline boarding passes: IATA BCBP standard (though Aztec Code is now preferred)
- Shipping: FedEx uses PDF417 on shipping labels
- Government: US Customs, visa stamps, vehicle registration
Implementation Notes
- Minimum X dimension: 0.17mm (6.7 mil) for general use
- Aspect ratio is flexible; adjust rows and columns for your label shape
- Higher error correction levels significantly increase symbol size
- Always test scanning from a distance representative of actual use