PDF417 Font & Encoder User Manual

Implementation Tutorials

Buy License Support Download Demo Release Log

Overview & Features

PDF417 is a 2D barcode type comprised of a stacked linear barcode format used in a variety of applications such as driver's licenses, vehicle titles and registrations, and inventory management.

Installation

All 2D barcode fonts require a 2-step installation process. As a courtesy, a Windows installation file is included in the package that automates the font installation procedure and installs the Font Encoder App and examples for Microsoft Office and Crystal Reports. For all other operating systems and encoders, the 2-step process is recommended.

  1. Install the IDAutomation2D barcode font. Extract the files from the download and install the font according to the Font Installation Procedures.
  2. Install a Font Encoder. Font encoders convert the data that is to be encoded into a text string that will generate the correct symbol when combined with the barcode font. Popular user-licensed font encoders are included in the package; Developer licensed encoders are in a separate download file that is provided with all Developer License orders.

Implementation Options

If the included font and graphic encoders are not supported in the application being used, there are a few other implementation options available:

  • Font Encoders may be used within an application that is known to be compatible such as Microsoft Excel or Word to encode the data into a special text string, which can then be moved to an application that can combine the font with that text string to create a readable PDF417 barcode.
  • Source Code is supplied with the purchase of any Developer License purchase and consists of about 1,200 lines of code using simple functions and arrays that may be easily converted to another programming language.
  • Barcode Label Software is a stand-alone application with VB scripting support and database connectivity.

Installation for Windows

The Windows installation installs the following components:

  1. PDF417 Encoder App Windows
  2. IDAutomation 2D Font
  3. Crystal Reports UFL and Font Formulas
  4. ActiveX Control and DLL
  5. Signed ActiveX CAB Files
  6. VBA Module
  7. Implementation examples

VBA Module for Excel and Access

The VBA module is required when using a font encoder in VB 6, Excel,  or Access, and is available in 2 forms:

  • The IDAutomation_PDF417_Macro.bas module accesses the ActiveX DLL for its encoder function. Created in C++, the ActiveX DLL is faster than the native VBA code. However, when distributing an application, the ActiveX DLL must be installed and registered on each computer to operate properly.
  • The IDAutomation_Native_PDF417_Macro.bas module is the complete encoder function in VB form. It may be slower than accessing the ActiveX DLL, and the ApplyTilde feature is unavailable. However, when distributing an application, the ActiveX DLL does not need to be distributed. This module is only supplied in the purchased version of the Font and Encoder Suite.

    Importing the VBA Module

      1. Extract the files provided with the product and run the installation executable to install the required files in the Application folder.
      2. Open the VB editor in Excel or Access:
        Excel 2007: Add the Developer tab, if not already there. Right-click on the Office Button in the upper left corner of the Excel screen and choose "Customize Quick Access Toolbar". Click on "Popular" at the top of the list on the left and then click "Show Developer Tab in the Ribbon" and save. Now go to Developer - Visual Basic - File - Import File
        Excel 2010 and later: Add the Developer tab, if not already there. Go to File - Options - Customize Ribbon, select "Developer" under Main Tabs on the right-hand side, and click ok. Now go to Developer - Visual Basic - File - Import File
      3. If importing the IDAutomation_PDF417_Macro.bas module, select Tools - References - IDAutomation PDF417 Barcode and then click ok.
      4. In the VB editor, select File - Import File and choose the module to import from the VBA folder. The native IDAutomation_Native_PDF417_Macro.bas module is only supplied in the purchased version of the product.
      5. If Excel or Access is being used, close the VB editor by selecting File - Close, then choose File - Save.
      6. After the file has been imported, the IDAutomation_PDF417 function may be called according to the chart below. The zero digit is the default for all parameters, which are optional and are used for automatic mode or a false setting. The one digit is used for a true setting. The parameters of the functions are defined in the API section of this manual.
         

        IDAutomation_Native_PDF417_Macro.bas

        IDAutomation_PDF417(DataToEncode As String, Optional EccLevel As Integer, Optional ColumnSpecify As Integer, Optional RowSpecify As Integer, Optional Truncate As Integer, Optional ForceBinary As Integer) As String Access Example

        =IDAutomation_PDF417([Test Data.data])
        or
        =IDAutomation_PDF417([Test Data.data],2,4,0,0,1)

        IDAutomation_PDF417_Macro.bas

        IDAutomation_PDF417(DataToEncode As String, Optional EcLevel As Integer, Optional TotalColumns As Integer, Optional TotalRows As Integer, Optional Truncated As Integer, Optional PDFMode As Integer, Optional ApplyTilde As Integer) As String Example

        =IDAutomation_PDF417([Test Data.data],2,4,0,0,0,0)

      Microsoft Access Implementation

      Using Font Encoders in Access

      1. Run the .exe file in the package and follow the steps to install the product.
      2. Import the VBA module into the Access database.
      3. Open an Access report in design mode.
      4. Add a text field to the report where the barcode will be positioned. Size the field appropriately so that it is large enough to display the barcode. Change the field's font point size to 8.
      5. Right-click the text field and enter the function call as a formula in the control source property. For example:
        =IDAutomation_PDF417([Test Data.data])
        The following formula combines 2 fields into a single symbol and inserts a tab function between them:
        =IDAutomation_PDF417([Test Data.TextData] & Chr(9) & [Test Data.NumberData])
      6. Save the report and run it. A special data string should appear in the text field, and this is the data that will create a correct barcode when combined with the PDF417 Font.
      7. Open the report in design mode and select the appropriate IDAutomation PDF417 font for the text field.
      8. Save the report and run it; a correct PDF417 barcode symbol should be displayed in the text field.

      How to Embed a Graphic PDF417 Encoder in Access

      The Native Barcode Generator for Access is an object that lives in the Access report itself, thus eliminating the need to install fonts or components such as ActiveX Controls or plug-ins. This product is unavailable as part of the PDF417 font and encoder packages and must be purchased separately.

      Microsoft Word Mail-Merge Implementation

      PDF417 barcodes may be created in a Word mail merge if Excel is used as the data source on Windows with the following procedure:

      1. Run the .exe file in the package and follow the steps to complete the installation.
      2. Import the VBA module into the Excel spreadsheet that will be used as the data source.
      3. Place a title in each column of the spreadsheet on Row 1 that will contain the data, and then import the data into the Excel spreadsheet.
      4. Select a blank column on Row 1, to the right of the last populated column in the spreadsheet, and title it Barcode.
      5. Add a formula on Row 2 of the Barcode column that calls the function as a formula.
        For example, the following formula adds columns A and B to the barcode:
        =IDAutomation_PDF417(A2&B2)
        The following formula adds only column A to the barcode, with some optional parameters:
        =IDAutomation_PDF417(A2,3,2,0,0,0)
        The following formula adds columns A, B, and C to the barcode and separates them with a comma delimiter:
        =IDAutomation_PDF417(A2&","&B2&","&C2)
      6. Highlight the cell with the formula in it and choose Edit - Copy.
      7. Select the entire range of cells to paste this formula into the Barcode column and choose Edit - Paste.
      8. Follow the procedures in MS Word to add this spreadsheet as the data source for the mail merge.
      9. Add the mail merge field of Barcode to place the barcode in the document.
      10. Highlight the «Barcode» merge field and select the IDAutomationPDF417 font.
      11. After the mail merge is performed, the barcodes should appear in the merged documents.
      12. A working example is provided in the Word Mail-Merge.doc file included in the Windows install package.

      Crystal Reports Integration

      IDAutomation provides two different Crystal Reports font encoder formulas within this package:

      • The Native Font Formula is the recommended font encoder that is embedded in a report. When distributing a report with this implementation, no other components are required except the 2D font. The slower speed of generation may not be an issue when encoding less than 100 characters. The native formula is only provided in the licensed version.
      • The UFL Font Formula accesses the Crystal UFL for the font encoder function. Created in C#, it is faster than the native formula. However, when distributing the report, the Windows installation executable file must also be installed to activate the UFL. Use the native formula if possible.

      While not part of this package, IDAutomation provides two other Crystal Reports implementations:

      FileMaker Pro Plug-in

      NOTE: The 2017 release of this product introduces a new FileMaker Font Encoder Object that is cross-platform compatible and easier to use than the Plugin. The provided Plugin does not support FileMaker 64-bit on the Mac and will not work with FileMaker Go in iOS. IDAutomation suggests using the font encoder object instead.

      IDAutomation's 2D Barcode Font may be easily integrated into FileMaker using dynamic calculated fields without the use of scripts with this FileMaker Plug-in. Encode up to 800 characters into a barcode, which is ideal for creating barcodes on badges, especially when concatenating multiple fields into a single barcode.

      PDF417 Badge Example

      View step-by-step instructions about installing, registering, and using the plug-in.

      Native JavaScript Font Encoder

      The Native JavaScript Font Encoder is a complete font encoder in a single JavaScript file; no other components need to be installed to create barcodes. This product is only provided in the purchased version of the Font and Encoder Suite. Following are the steps for using the Native JavaScript Font Encoder in HTML:

      1. Open the HTML document or application where the barcode will be integrated.
      2. Add the following line at the top of the file just before the </head> line to load the appropriate JavaScript file:
        <script language="JavaScript" src="IDAutomation_PDF417.js"></script>
      3. Add the barcode font as a class to be called in the document for the barcode to appear just before the </head> line:
        <style type="text/css">
        .barcodefont1 {
        font-family: "IDAutomation2D", "IDAutomation2D N5", "IDAutomation2D XLS", "IDAutomationPDF417n3", "IDAutomationPDF417n5", "IDAutomation2D S";
        font-size: 200%;
        }
        </style>
      4. Add a script where the barcode is to appear in the HTML document or text object, which is the file name without the ".js":
        <span class="barcodefont1">
        <script type="text/javascript">
        document.write(IDAutomation_PDF417("www.IDAutomation.com"))
        </script>
        </span>
      5. Modify DataToEncode with what is to be encoded in the barcode. This may be accomplished with a variable in JavaScript or a dynamically generated webpage.
      JavaScript Font Encoder Parameters
      function IDAutomation_PDF417(DataToEncode, ApplyTilde, EccLevel, ColumnSpecify, RowSpecify, Truncate, ForceBinary, XYRatio, HTML, IDElement)
      Example
      IDAutomation_PDF417("www.IDAutomation.com",null,null,null,null,null,null,null,null,'target');

      /** Default values **/// Change these lines to set a new default value for parameters in the .js file

      var IDAutomation_PDF417_default = {
      'ApplyTilde': false, //When false does not processes tilde commands
      'ForceBinary': false, //Forces binary encoding mode
      'EccLevel': 0, //Error correction level 1-8; 0=automatic 
      'ColumnSpecify': 0,
      'RowSpecify': 0,
      'Truncate': false,
      'XYRatio': 3,
      'HTML': 1 //1=use 
       for carriage returns | 0=use CR LF for carriage returns
      }

       

      Using the .NET DLL in .NET Applications

      Implementing PDF417 barcodes in .NET applications may be accomplished with the .NET DLL font encoder or the .NET Forms Control graphic encoders. Information about printing from the .NET Forms Control without using the font is provided in the .NET Forms Control User Manual.

      .NET PDF417 Font Encoder Example

      The following is an example using the font encoder to obtain the data that when printed with IDAutomation's PDF417 Font, will create an accurate barcode. The source code for this font encoder example is provided in the package for testing and reference.

      1. In a .NET project, add a reference to the DLL and place the import statement in the declarations section of the project. For example:
        Imports IDAutomation.Windows.Forms.PDF417Barcode
      2. Obtain the string of data that when printed with IDAutomation's PDF417 Font, will create a correct barcode:
        Dim NewBarcode As PDF417Barcode = New PDF417Barcode() 
        TextBox2.Text = NewBarcode.FontEncoder(TextBox1.Text, 0, 0, 0, False, PDF417Barcode.PDF417Modes.Text,True)

      C# Example:

      1. In a .NET project, add a reference to the DLL and place the using statement in the declarations section of the project. For example:
        using IDAutomation.Windows.Forms.PDF417Barcode;
      2. Obtain the string of data, that when printed with IDAutomation's PDF417 Font, will create a correct symbol:
        PDF417Barcode NewBarcode = new PDF417Barcode();
        textBox2.Text = NewBarcode.FontEncoder(textbox1.Text, 0, 0, 0, false, PDF417Barcode.PDF417Modes.Text, true)

      Using the Java Class PDF417 Font Encoder

      This section describes using the font encoder process to generate PDF417 barcodes using Java. Implementation of PDF417 in Java as a graphic encoder is described in the Java User Manual.

      Installing the Java Encoder Class Library

      Copy the PDF417Encoder.class file from the Java Class Encoder folder of the package to the root directory of the computer's classpath. If assistance is needed with the classpath, consult the Java documentation or the company from where the Java virtual machine was acquired.

      Integrate the Java Font Encoder Method

      After the Encoder Class Library is installed, it may be called from an application as in this example:

      import java.io.*;
      //import IDautomationPDFE.*; //Java 1.4 version
      import com.idautomation.fontencoder.pdf417.*; //Java 11 version
      class PDFTest {
          public static void main(String[] args) {
              String dataToEncode = "This is a test of the IDAutomation.com PDF417 Java
      Encoder.";
              PDF417Encoder pdfe = new PDF417Encoder();
              System.out.println(pdfe.fontEncode(dataToEncode));
          }
      }

      The data string returned by the FontEncode method will create a proper PDF417 symbol when displayed or printed with the PDF417 font. To install the font on an operating system, consult the operating system's documentation.

      Configuration parameters and methods of the PDF417 for Java font encoder class:

      • fontEncode() - the main method that formats and returns a string of data formatted to the PDF417 Font.
      • PDFColumns - number of columns for PDF417 (the default is 5).
      • PDFECLevel - error correction level for PDF417 (the default is 2).
      • PDFMode - the PDF417 mode can be NUMERIC, TEXT,  or BINARY (the default is BINARY).
      • truncated - if set to "true", truncated symbols will be created according to the ISO specification.

      Using the COM DLL

      Install the product by running the .exe file provided in the package. Upon execution, it installs TrueType fonts, and implementation examples and registers the ActiveX DLL. To register the DLL manually, perform the following:

      1. Copy the DLL to the \System directory.
      2. Register the DLL in the command prompt, change to the \system directory, and type the command REGSVR32 "IDAutomationPDF417.dll".
      3. After the DLL is installed and registered, it may be accessed by any application that can retrieve a text string or graphic object from a COM DLL.

      When using the COM DLL as a graphic encoder, refer to the steps in the ActiveX Control Manual. When using the COM DLL as a font encoder, the FontEncode function is used to convert the data to encode into a string that when combined with the PDF417 font, will create a correct barcode. The following is Visual Basic 6 code that places the converted data in the Output string:

      Dim Output as String
      Dim PDF417FontEncoder As PDF417Lib.PDF
      Set PDF417FontEncoder = New PDF
      PDF417FontEncoder.FontEncode DataToEncode, 0, 0, 0, 0, 0, 0, Output

      A Visual Basic project example is included with the package. These files are placed in the destination directory upon installation.

      COM and .NET DLL Methods and Properties

      There are a variety of methods and properties available in the COM and .NET DLL PDF417 encoder components.

      • TotalColumns: The number of data columns in the PDF417 barcode will control the width of the barcode. The maximum number allowed is 30 but leave at 0 for the default.
      • EcLevel: The level of Reed Solomon error correction in the symbol. More error correction creates a larger symbol that can withstand more damage. Leave at 0 for the default.
      • PDFMode: Binary mode encodes bytes of data; text mode encodes all characters on the US keyboard plus returns and tabs. The default of 0 is binary mode; 1 is text mode which only encodes ASCII 9, 10, 13, and 32 - 127 but takes up less space.
      • TotalRows: The minimum number of total rows can be set by this. Leaving this setting at the default of 0 is suggested.
      • Truncated: A truncated PDF417 symbol is more area-efficient than a standard PDF417. By selecting this option, the right-hand side of the PDF417 is removed or truncated. This option should only be used in clean environments because it is more susceptible to damage than standard PDF417 barcodes.
      • ApplyTilde: If set to True" use the format ~ddd to specify the ASCII code of the character to be encoded. It is off by default. For example, if the text ~029AB is entered in the data field, it will be encoding GSAB where GS is a delimiter ASCII 29 character. This can be used in a single string to encode GS and RS characters (GS = ASCII 29 and RS = ASCII 30). Other commonly used ASCII codes are ~009 for a tab and ~013 which is a return function. These are useful when encoding multiple fields in a single symbol.

      COM DLL FontEncode Method

      FontEncode (DataToEncode As String, EcLevel As Integer, TotalColumns As Integer, TotalRows As Integer, Truncated As Integer, PDFMode As Integer, ApplyTilde As Integer, Output as String)

      Example: PDF417(InputString,"0","0","0","0","0","0",OutputString)    (Enter zeros for defaults in all integer fields)

      .NET DLL FontEncoder Method

      FontEncoder (DataToEncode As String, EcLevel As Integer, TotalColumns As Integer, TotalRows As Integer, Truncated As Boolean, PDFMode, ApplyTilde As Boolean)

      Example: TextBox2.Text = NewBarcode.FontEncoder(DataToEncode, 0, 0, 0, False, PDF417Barcode.PDF417Modes.Text, True)

      View the ASCII chart for additional details.

      PDF417 C++ .H Header File

      The C++ header file for PDF417 may be provided with the purchase of a Developer License of the Font and Encoder Suite. The header file is an unobfuscated C++ source code that makes use of character vectors. It was compiled and tested with Visual Studio 2005 and 2008 and does not contain any OS-specific code. The PDF417FontEncoder class may be used to return an encoded string that the PDF417 font can be applied to, to create PDF417 barcodes. This class also contains several properties and enumerations that adjust the resulting symbol size and encoding method.

      C++ Implementation example

      #include <string>
      #include <iostream>
      #include "PDF417FontEncoder.h"
       
      int main ()
      {
           PDF417FontEncoder PDF;
           long ECL = 3;
           PDF.setApplyTilde(true);
           PDF.setErrorCorrectionLevel(ECL);
           PDF.PDF417Mode = PDF417FontEncoder::PDF417Modes::Binary;
           PDF.setDataToEncode("IDAutomation.com");
           printf(PDF.FontEncode().c_str());
      }

      MacroPDF417 Methods and Properties

      Many of the encoders in this package support MacroPDF, which allows additional data to be encoded by dividing the data into multiple barcode symbols.

      Java and .NET fontEncodeMacroPDF Method

      String fontEncodeMacroPDF(String DataToEncode, int inEccLevel, int inColumnSpecify, int inRowSpecify, boolean inTruncate, int inMode, int inMacroSegIndex, int inMacroFileId, boolean inMacroLastIndex)

      COM DLL and ActiveX Control FontEncodeMacroPDF Method

      FontEncodeMacroPDF(BSTR DataToEncode, int inEccLevel, int inColumnSpecify, int inRowSpecify, int inTruncate, int inMode, int inTilde, int inMacroSegIndex, int inMacroFileId, int MacroLastIndex, BSTR *ReturnVal);

      Support

      Frequently Asked Questions

      Can the font just be applied to the data to create a PDF417 symbol?

      Implementing the PDF417 font requires the use of both the fonts and the encoders. To generate an accurate PDF417 barcode from a font, the data you wish to turn into a barcode must first be encoded into a text string that will create a readable PDF417 barcode once the appropriate font is applied to it. The purpose of the encoder is to convert the data to be encoded into proper bar and space patterns formatted to the PDF417 barcode font.

      Using an encoder is necessary due to the complexity of the symbology and the required Reed Solomon error correction. Attempts to manually encode this data would be extremely complicated, and the font encoders are available to make this procedure much faster, easier, and error-free.

      What are the benefits of printing PDF417 as a font?

      PDF417 fonts are more flexible than other components such as an ActiveX control or .NET Forms Control because the fonts can be combined with these ActiveX, .NET, Java, and other encoders depending on which will work best in a given environment.

      Can extended characters such as © ® ë ö be encoded and scanned?

      Yes, it is possible to scan and encode extended characters in a PDF417 barcode, provided the following steps are taken:

      1. Encode the data using BASE256. This option encodes ASCII 1 to 255 of the ASCII character set. When encoding over 1024 characters of data, ASCII 127-160 must also be encoded in the format ~ddd, with ApplyTilde set to true.
      2. Scan the PDF417 barcode via the serial interface option (data bits have to be 8N) on the scanner. Normally, keyboard wedge and USB scanners do not support extended characters above ASCII 128, and can only scan characters that are on the keyboard. Contact the scanner vendor for more information on how to enable extended character recognition, as some of the scanner's internal settings might need to be modified.

      Popular Forum Post Resolutions:

      Common Problems and Solutions:

      Line Spacing Issues: Too Much Space Between Lines

      Some implementations of PostScript fonts can cause a small space to appear between rows in the PDF417 symbol. The only way to resolve this issue is to confirm that the print application is not adding additional line feeds. Or, in the case of PCL fonts, change the vertical motion index as indicated below. This space will not cause problems with scanners and the barcode will still be readable.

      When using 12 or 14-point PCL fonts, an adjustment to the vertical motion index is not usually necessary. However, if other sizes are used, an adjustment may be needed to close the gap between rows. To set the vertical motion index, issue the command before printing with the PDF417 font. The code for the Vertical Motion Index Command is escape "<Ec>" + "&" + lowercase L "l" + Number Index + Capital "C". Use the chart below to find the command for the specific font point size. The number may be adjusted as necessary for the printer.

      PCL Font Point Sizes Vertical Motion Index Commands
      10 <Ec> &l6.5C
      8 <Ec> &l5.2C
      6 <Ec> &l3.9C

      In the example above, the <Ec> represents the escape character for the software. In DOS Edit, Ec is represented by holding down the CTRL key and pressing the letter P, release both keys and then press the ESC key.

      X-Axis Issues or Left Margin Alignment Issues

      This issue may exist if there is an attempt to move the barcode to the right on the X-axis using a programming language, such as Visual Basic. When using the printer.currentX specification to set the X-axis, only the first line of the barcode would print in the new position and the remaining lines would print at zero, all the way to the left. This is because the printer.currentX specification is reset every time a return is performed. A return must be performed to print the font on the new line.

      The best solution to this problem would be to find a command that could move the left margin so that returns will move the insertion point to the correct position. Since Visual Basic does not have a command such as this, a small piece of code must be written to set the currentX for each line.

      1. Declare and initialize a variable with the desired X position. Example:
        my_x = printer.currentX
      2. Replace the Printer.Print OutputString command with something similar to the following:
        For i = 1 To Len(Output)
            out1 = out1 & Mid(Output, i, 1)
            If Mid(Output, i, 1) = Chr(10) Then
                out1 = Replace(out1, Chr(10), "")
                out1 = Replace(out1, Chr(13), "")
                Printer.CurrentX = my_x
                Printer.Print out1
                out1 = ""
            End If
        Next i

      PDF417 Font Specifications

      Character Sets GLI0 encodes ASCII 0 to 255 of the ASCII character set.
      Data Compaction Modes Text Compaction with all four sub-modes supports text and numbers.
      Byte Compaction mode supports numbers, text, and binary data.
      Error Correction Levels Selectable from 1 to 8

      Current Font Names Notes
      IDAutomation 2D

      IDAutomation 2D N5
      IDAutomation 2D XLS

      Beginning with the 2015 release, this product was updated to use the Universal 2D Font, which is compatible with all encoders of this product. The Universal 2D Font enables PDF417 and matrix barcode types such as Aztec, DataMatrix, and QR Code to be created from the same font.

      Several 2D fonts are provided in the package to support N dimensions of 3 and 5. For specifics, refer to the Universal 2D Font Specifications.

      The 2D XLS font is designed to be used in Excel only.

      Fonts Prior to 2015 Notes
      The PDF417 fonts listed below are available within the "Legacy Fonts" folder of the product zip file in case they are needed.
      IDAutomationPDF417n3 The standard PDF417 font with an X-to-Y ratio of 1:3 which is recommended by national and international standards. Y dimension = 3X
      IDAutomationPDF417n4 A taller, thinner PDF417 font for use with lower-quality readers and special applications. It has an X dimension of .75 times the X dimension of PDF417n3. It has an X-to-Y ratio of 1:4. It may be necessary to increase the font size after switching to this ratio.
      IDAutomationPDF417n5 A taller, thinner PDF417 font is designed to be used for FedEx label specifications and other applications that require an X-to-Y ratio of 5. The X dimension of this font is .010" or 10 MILS when printed at 11 points.
      IDAutomationPDF417n2 A shorter version of the PDF417 font for high-quality imagers and scanners. It has an X dimension of 1.5 times the X dimension of PDF417n3 and an X-to-Y ratio of 1:2. This font may be used to reduce the symbol height if a high-quality scanner is being used in a clean environment. It may be necessary to decrease the font size after switching to this ratio.

      Note: Most scanners cannot dependably read this font.

      Related Information