Capable of containing large amounts of data in a variety of characters.
Used mainly for identification cards, inventory, and transport.
Dimensions of this barcode can be set; also contains a truncated version.


* 200 character limit for this demo.


$colorFront = new BCGColor(0, 0, 0);
$colorBack = new BCGColor(255, 255, 255);

// Barcode Part
$code = new BCGpdf417();
$code->setColor($colorFront, $colorBack);

// Drawing Part
$drawing = new BCGDrawing('', $colorBack);

header('Content-Type: image/png');


Technical Specifications

PDF417 symbol is an ISO international standard (IEC 15438). You are allowed to use it in your applications.

The PDF417 code is a 2D barcode that can encode large amounts of information within a square symbol. All 256 characters can be encoded.
You may use multiple symbols to spread your information in order to create a bigger message.

This barcode contains a way to detect and correct errors based on the Reed Solomon algorithm. The level of correction included can be between 0 and 8.


Table: Capacity for a PDF417 code depending on its error level
Error Level Number of keywords required for correction Number of keywords maximum for data
0 2 925
1 4 923
2 8 919
3 16 911
4 32 895
5 64 863
6 128 799
7 256 671
8 512 415


Keywords correspond to a pattern with bars and spaces. A keyword is 17 pixels wide (but for the last column, there are 18).
Keywords for the left and right columns are always the same. They are used to identify the PDF417 code. The 2 other columns touching these columns are "fixed" and are based on the number of lines and error level. No real data is written in these columns.
Data is in between the columns 3 to X-2 included (one indexed and X is the number of columns).

There are 3 tables containing keywords which allow you to encode the barcode. They are used one after the other depending on the line number currently written.

The text you want to write is converted into keywords; there are different encodings in order to get these keywords. Encodings with their meanings are written below. The underlined text is the compression level.

  • Text (2 characters per keyword): Default mode which allows you to encode capital letters, lower case and many punctuation characters. (ASCII 9, 10, 13 &amp; 32 to 127). You will save space if you write your message only in capital letters or only in lower case instead of switching back and forth between these two kinds of letters.
  • Byte (1.2 byte per keyword): 1.2 byte per keyword=9
  • Number (2.9 numbers per keyword): Mode which allows you to encode all the numbers with a good compression level.

The Reed-Solomon code is added next to the data keywords in order to detect and correct the errors. If there is still some room available for keywords, padding keywords are added to the data.

Barcode Bakery Supports

Encodes Characters, Numbers, Binary Available
PDF417 Truncated Available
Encodes on many codes (Structured Append) *
Extended Channel Interpretation (Arabic, Hebrew, etc.) *
Specific to .NET package
.NET 4.0+ Available
* Will be supported in the next versions