PDF417 is stacked rather than matrix: rows of codewords, each 17 modules wide and made of four bars and four spaces, which is where the name comes from. Driving licences and boarding passes carry it because a linear scanner sweeping across the rows can read it.
An aspect ratio sets the shape, and the nine error correction levels run from 2 correctable codewords at level 0 to 512 at level 8.
Type Token
| Item | Value |
|---|---|
| Type token | PDF417 |
| Enum case | BarcodeType::PDF417 |
| Family | 2D |
| Standard | ISO/IEC 15438 |
| Class | \Com\Tecnick\Barcode\Type\Square\PdfFourOneSeven |
Input
| Item | Value |
|---|---|
| Character set | any byte sequence |
| Length | up to 2710 digits or 1850 text characters |
| Check | Reed-Solomon error correction at the chosen level |
| Extra parameters | 3 (see below) |
Extra Parameters
Appended to the type token after commas, as in PDF417,2,5.
| Position | Meaning | Values | Default |
|---|---|---|---|
| 1 | aspect ratio | a number not less than 1 | 2 |
| 2 | error correction level | 0 to 8 | automatic |
| 3 | macro block parameters | segment index, file id and options | unset |
Examples
Digits at the automatic error correction level
<?php
require_once __DIR__ . '/vendor/autoload.php';
$barcode = new \Com\Tecnick\Barcode\Barcode();
$bobj = $barcode->getBarcodeObj(
type: 'PDF417',
code: '0123456789',
width: -4,
height: -4,
color: 'black',
padding: [0, 0, 0, 0],
)->setBackgroundColor('white');
echo $bobj->getInlineSvgCode();
Aspect ratio 4 at error correction level 2
$bobj = $barcode->getBarcodeObj(
type: 'PDF417,4,2',
code: 'tc-lib-barcode',
width: -4,
height: -4,
color: 'black',
padding: [0, 0, 0, 0],
)->setBackgroundColor('white');
Errors
These payloads raise \Com\Tecnick\Barcode\Exception:
| Payload | Message |
|---|---|
| `` | Empty input |
See Also
- tc-lib-barcode : the library overview.
- Rendering Options : size, colour, padding.
- Output Formats : every renderer.
- Compact PDF417 : the compact form.
- CODE 49 : an earlier stacked format.
- API reference : the generated class documentation.