The PDF417 barcode is a two-dimensional (2D), high-density symbology capable of encoding text, numbers, files and actual data bytes. This FAQ provides information and answers to commonly asked questions.
- PDF417 Overview
- Generating and Printing PDF417 Barcodes
- PDF417 2D Barcode Scanner
Fig. 1: AIM recommended EC levels
|EC Codewords Generated||2||4||6||8||16||32||64||128||512|
|Data Bytes Encoded||1-56||57-192||193-384||385-1035|
- The X dimension is the width of the narrowest bar in a printed codeword. The Y dimension is the height of each row within the PDF417 symbol. The PDF417 barcode is usually printed at an X to Y ratio of 1:2 to 1:5, with 1:3 being the most popular. By lowering the ratio, a significant amount of space can be saved; however, some scanners cannot read X to Y ratios of less than 1:3. Most scanners, such as the IDAutomation PDF417 2D USB Scanner, read PDF417 barcodes well at 1:3. When creating symbols with more than 10 columns, IDAutomation recommends using a ratio of 1:4 or 1:5.
- The number of rows and columns can be selected, allowing the symbol to be created in various forms. However, the PDF417 barcode symbol is limited to 30 columns and 90 rows. Keep in mind when selecting columns, only the number of data columns in the symbol are being selected. The normal PDF417 barcode symbol has two row start columns and two row stop columns. Truncated PDF417 contains only two row start columns. Some scanners and decoders cannot dependably read over 20 columns.
- A truncated PDF417 symbol uses less area than the normal PDF417 barcode. By selecting this option, the right hand side of the symbol is removed or truncated. This option should be used primarily in a clean environment, since it is more susceptible to damage.
To find the printed Y dimension
- Print a PDF417 barcode symbol with exactly 10 rows.
- To obtain 10 rows, choose 5 columns, an error correction of 2 and print the text of “IDAutomation.com, Inc. PDF417 ActiveX Control” with binary encoding.
- Measure the distance from the top of the symbol to the bottom and divide by 10.
- Example: if 10 rows measured .425 inches, then .425″ divided by 10 equals .0425″, giving a Y dimension of 42 mils per row.
To find the printed X dimension
- Measure 6 or more columns, but do not include the start and stop columns in the measurement, divide this number by the number of columns measured, then by 17. The result is the X dimension.
- Example: if 6 columns measure .875″, divide .875″ by 6, which equals .14583″ per column. Because the X dimension width of each column is 17, take the .14583″ and divide it by 17, which equals .00857″, which is about 8 mils.
If it is necessary to encode more than 800 characters, IDAutomation recommends using Macro PDF mode or multiple separate symbols. In the best-case scenario, using the text encoding mode of the IDAutomation PDF417 Forms Control with the IDAutomation 2D Barcode Scanner, up to 1200 characters were successfully encoded and retrieved.
Each codeword represents 1 of 929 possible values, which allows data to be compacted into the codewords to save space. PDF417 has three data compaction modes: binary, text and numeric. Binary compaction encodes actual bytes of data; text mode encodes most characters on the U.S. keyboard (ASCII 32-126) including ASCII 9 (the tab function) and ASCII 13 (the return function). Numeric compaction encodes only numbers, is rarely used and not available in all products due to calculation limitations. The chart below provides more detail about these modes.
|Compaction Type (Numeric Value)||Data Encoded||Maximum Compaction|
|Binary Compaction (0)||ASCII – 0 to 255||1.2 bytes per codeword|
|Text Compaction (1)||ASCII – 9,10,13 & 32-126||2 characters per codeword|
|Numeric Compaction (2)||only numbers 0-9||2.9 digits per codeword|
To encode the most amount of data into the smallest possible symbol:
- Use TEXT compaction mode.
- Decrease the error correction level to 2.
- Increase the number of columns to the largest possible size.
- Decrease the X dimension to the smallest possible size the scanner will read.
- Turn on truncation, which decreases the symbol size by two columns.
- Choose an X to Y ratio of 1:3.
Java: DataToEncode= “PDF” + (char)9 + “417”;
Visual Basic & VBA: DataToEncode= “PDF” & ChrW(9) & “417”
Crystal Reports VB & SSRS: DataToEncode= “PDF” & Chr(9) & “417”
The following is a summary of the PDF417 barcode requirements for FEDEX label printing:
- The PDF Security Level or Error Correction Level must be set to 5.
- The X dimension must be 10mils (.010″ or .0254 CM) with an X to Y ratio (or N Dimension) of 5. To achieve this with the PDF417 Font and Encoder, print with IDAutomation2D N5 or the IDAutomationPDF417n5 font at 12 points.
- The number of columns should be set to 10.
- The entire message should not exceed 350 characters.
- The quality of the symbol must be ANSI grade “A”. The IDAutomation 2D Barcode Scanner’s Print Quality Assessment may be used as a guide for this requirement.
- The data encoded must begin with: [)>RS01GS where RS is ASCII 30 and GS is ASCII 29. In IDAutomation products, if ApplyTilde if set to “True” or “1,” the format ~ddd is used to specify the ASCII code of the character to be encoded. These characters cannot be viewed or printed and therefore it may not appear to be present, unless an application is used such as IDAutomation’s Barcode Scanner ASCII String Decoder.
NOTE: The code supplied below is an example and not a complete solution. More information about structuring messages to meet FedEx label specifications may be found at the .
char GS = (char)29; char RS = (char)30; char EOT = (char)4; rm.setData("[)>"+RS+ "01"+GS+ "9633626"+GS+ "840"+GS+ "002"+GS+"12345678901"+GS+"RPSC"+GS+"0988443"....
Visual Basic Example:
Dim NewMessage As String Dim GS As String Dim RS As String Dim EOT As String GS = Chr(29) RS = Chr(30) EOT = Chr(4) NewMessage = "[)>" + RS + "01" + GS + "9633626" + GS + "840" + GS + "002" + GS + "12345678901" + GS + "RPSC" + GS + "0988443"... PDF4171.DataToEncode = NewMessage
IDAutomation PDF417 barcode products all support the format ~ddd to specify the ASCII code of the character to be encoded, which allows easy encoding of GS, RS and EOT from the command line.
For example, the following string:
“[)>”+RS+ “01”+GS+ “0133626”+GS+ “840”+GS+”002″+GS…
May also be encoded with this string:
[)>~03001~02996336260000~029840~029002~029….Before implementing the printed PDF417 barcodes for FedEx applications, it is recommended to verify the symbol with the Print Quality Assessment test of the IDAutomation 2D Barcode Scanner or another suitable verifier. Additionally, the 2D Scanner together with the Free Barcode Scanner ASCII String Decoder may be used to view the non-printable RS, GS and EOT lower ASCII functions, which will appear as tags. To perform the test, simply open the Barcode Scanner ASCII String Decoder and scan a MaxiCode symbol with the Image Reader.
It is possible to scan and encode international and extended characters, provided the instructions below are followed:
- Encode the data using binary encoding. This option encodes all data, byte-by-byte.
- Scan the data with a scanner capable of reading and decoding binary data. With some scanners, this is only possible via the serial interface option with data bits set to 8N. Normally, keyboard wedges and USB scanners do not support extended characters above ASCII 128, and only scan characters that are actually on the keyboard. Contact the scanner vendor for more information; some of the scanner’s internal settings may have to be modified.
IDAutomation 2D Barcode Scanner. The quality assurance test will grade the symbol and report the X dimension, Y dimension and any possible problems. The report below was generated when scanning the PDF symbol to the right with PQA enabled:
>> PQA << PDF417: 10 rows x 3 cols, 22 data & 8 chks (ECL = 2) X roughly = 0.009" [A] < Row Height = 3.1 X [A] < Useful Row Height = 2.4 X (76% Row) [A] < Data Safety Margin = 100% (0 Erasures & 0 Errors) [A] < Edge Accuracy = 72% [A] < Print Growth = +1% of X
- .NET Windows Forms Controls – used to create and print barcodes from local .NET applications.
- ASP.NET Server Control – Custom Server Control designed to be used in ASP.NET Web Applications
- ActiveX Barcode Control & DLL – this is the best product to use for Microsoft® Access reports and Visual Basic 6. It may also be used in C++.
- Barcode Image Generator – generates images one at a time or from the command prompt.
- Java Barcode Packages – these packages include JavaBeans, Servlets, Class Libraries & Applets that may be used on any operating system with a Java Virtual Machine including Linux, UNIX and Mac.
- Streaming Barcode Server for IIS – adds barcode streaming generation capability to Microsoft Internet Information Server.
| First Segment:
MacroPDFEnable = True
MacroPDFFileID = 237
MacroPDFSegmentIndex* = 0
MacroPDFLastSegment = False
MacroPDFEnable = True
MacroPDFFileID = 237
MacroPDFSegmentIndex* = 1
MacroPDFLastSegment = True
- Macro PDF Enable – A boolean indicating that this barcode is part of a MacroPDF417 sequence.
- Macro PDF File ID – Assigns a file ID to the MacroPDF barcode. Each barcode in the MacroPDF sequence must have the same file ID assigned to it. Default is 0; valid options are 0-899.
- Macro PDF Segment Index – The index number of this MacroPDF barcode in relation to the set. Default is 0; valid options are 0-99998; * each barcode in the MacroPDF sequence must have a unique segment index, starting at zero and incrementing thereafter by 1.
- Macro PDF Last Segment – A boolean indicating that this is the final barcode in the MacroPDF sequence.