Chapter 2. Overview

This chapter briefly reviews the symbologies (a.k.a. barcode formats) supported by PDF417 Fontware. PDF417 Fontware & Writer SDK supports normal PDF417, truncated PDF417 and Macro PDF417.

2.1. What is PDF417?

PDF417 is a multi-row, variable-length symbology with high data capacity and error-correction capability. PDF417 offers some unique features which make it the widely used 2D symbology. A PDF417 symbol can be read by linear scanners, laser scanners or two-dimensional scanners. PDF417 is capable of encoding more than 1100 bytes, 1800 text characters or 2710 digits. Large data files can be encoded into a series of linked PDF417 symbols using a standard methodology referred to as Macro PDF417.

Figure 2.1. Anatomy of a PDF417 symbol

Anatomy of a PDF417 symbol

A PDF417 symbol is composed of several key elements. These elements are module, codeword, start pattern, stop pattern, row indicator, row and column. Each key element is explained below.


A module is the smallest unit of a PDF417 symbol. The individual row height in a symbol is equal to the module height. The width of a module is commonly referred as X dimension. The ratio of the module height vs. width is called y-height. For better decodability, y-height should be no less than 3.0.

All other elements, such as start pattern, stop pattern and codewords, are composed of modules.

start pattern

A unique pattern of light and dark elements which indicates the leftmost part of a PDF417 symbol. All the rows start with the same pattern, with the result that the entire leftmost part of the symbol appears as a set of vertical bars and spaces.


A codeword contains four bars and four spaces, totaling 17 module widths and 1 module height. Each codeword starts with a bar and ends with a space. PDF417 encodes user data into codewords. Each codeword represent an integer value from 0 and 928.

stop pattern

A unique pattern of light and dark elements which indicates the rightmost part of a PDF417 symbol. Same as start pattern, all rows of PDF417 symbols share the same stop pattern.

row indicators

The two code words adjacent to the start or stop pattern in a row are row indicators. They encode information about the structure of the PDF417 symbol in terms of the row identification, total number of rows and columns and the error correction level.


A set of elements made up of a start pattern, row indicators, data codewords and a stop pattern. A PDF417 symbol must have at least 3 rows and no more than 90.


A column refers to the set of codewords vertically. It does not include start pattern, stop pattern and row indicators. A PDF41 symbol may have 1 to 30 columns.

In Figure 2.1, “Anatomy of a PDF417 symbol”, there are 9 rows and 3 columns.

Creating PDF417 symbols can be thought as two distinct processes: encoding and rendering. Your application first calls a encoder function to convert the data into an integral representation. During this step you specify the parameters desired, such as number of rows columns, or aspect ratio. After encoding succeeded, you can one of rendering API to render the barcode in a variety of graphics formats supported, such as Windows metafile or PNG. If you are using fonts, you retrieve barcode string and format the barcode string with one of the fonts to turn them into a barcode.

2.2. Encoding Parameters

The minimum encoding parameters required are data encoded and security level. These two parameters decide the minimum number of codewords required. Once the number of minimum codewords is known, the program determines the size of the barcode based on other sizing parameters, such as number of rows and aspect ratio.

2.2.1. Input Format

PDF417 is capable of encoding all 256 values (bytes). Except the NUL character, which serves as the terminator for C language, you can enter all these characters as is. However, in some situations you may want to use the escape method, because your environment does not support entering control characters, or you are entering symbology specific features. For example:

  • To specify advanced PDF417 features such as ECI and Macro PDF.

  • To enter NUL character (ASCII code 0) and other control characters.

  • To enter extended characters with pure ASCII.

The escape method described here is called tilde method. When creating PDF417 barcodes you can use the following tilde codes:


When nnn corresponds to a numeric value between 0 and 255, the tilde code sequence represents a character with value equal to nnn. For example, ~d032 represents a space character.


Represents a tilde (~) character.


Indicates that a MacroPDF417 control block follows.


Indicates the start of a ECI block. This escape sequence must be followed by exact 6 digits, which corresponds to the ECI value.


Represents a character value from 0 to 26. Replace the X like in the following example ~@ means character ASCII 0, ~A means character 1, ~B means character 2, ~C means character 3 ...

For more information on entering ECI and Macro PDF417 block, see Appendix A, Input Format for ECI and Macro PDF417.

2.2.2. Security Level

PDF417 allows users selection of security level. While the default algorithm[2] is appropriate to most applications, you may want to increase the amount of error correction. Higher error correction level increases the size of the barcode, but is more resistant to various errors, such as printing error and symbol damage during the transport.

Internally, each symbol uses one of eight levels of error correction. Increasing the error correction by one level doubles the number of error correction codewords. In turn, it roughly doubles the amount of damage that the symbol can tolerate.

In our software, you can specify 9 to indicate that you want to use the default algorithm.

Since a PDF417 symbol must be rectangular, when the total number of data and security codewords does not make up a rectangle, padding codewords are added to fill the spaces. The padding codewords just fill the space, and do not increase the error resistance of the symbol[3] For this reason, our software consider the security level you requested as minimum, not the exact requirement. That is, if the symbol size required can't satisfy the security level requirement, the software reports an error. However, if the security level can be increased within the size specified, it selects a higher security level. The principle here is to reduce the number of useless padding codewords and increase the ECC codewords without increasing the overall symbol size. This arrangement makes the symbols produced more robust.

2.3. Sizing Parameters

After the minimum number of codewords are determined, the encoder selects a size that can fit these codewords. The encoder is quite flexible here: you can specify the exact number of rows and columns, or you can leave all the choices to the encoder.

The size of a printed PDF417 symbol is calculated as follows:

  symbolwidth = (numCols*17+69)*moduleWidth
    symbolHeight = numRows * yHeight * moduleWidth 
Specifying Exact Number of Rows and Columns

If you want all your symbols have identical sizes, you may specify the number of rows and columns to the ones required. In this scenario, you need to ensure that the size specified can hold the largest data possible, otherwise the encoder will report an error.

Specifying Either Number of Rows or Columns

Sometimes it is easier to specify one parameter and allow another parameter to grow if needed. This is useful when you occasionally have data that requires larger sizes.

For example, most of your data will fit a 11X7 rectangle. However, sometimes your data will require 14X7 rectangle. You can specify 7 as the number of columns, and leave the selection of rows to the encoder.

If another parameter, AspectRatio is not specified, the encoder will choose a combination that produces the minimum number of codewords. Otherwise, it selects a combination that produces a symbol with its aspect ratio closest match to the one specified.

Specifying Neither Number of Rows nor Columns

This scenario is not recommended, however supported by the encoder. When neither number of rows nor the number of columns is specified, the encoder will choose (1)if AspectRatio is not specified, the combination that requires the minimum number of codewords. (2) The combination that produces a symbol whose aspect ratio is the closest match to the value specified.

Because of the nature of PDF417 symbol, if you do not specify Aspect Ratio, the resulted barcode is normally a short and wide one, as it is always efficient to expand horizontally than vertically. If you do not like this behavior, set Aspect Ratio accordingly.

2.3.1. Impact of Aspect Ratio

Apsect Ratio does not affect the decision when you specify both the number of rows and columns. when you only specify one of them, or not at all, it kicks in. The aspect ratio of a symbol is the ratio of its overall height vs. its width. For example, if your aesthetics suggest that the symbol looks better when the width is approximately 3 times its height, the aspect ratio is 0.33.

The value of aspect ratio is considered recommended unlike other parameters. Other parameters entered are either considered minimum (such as security level) or exact (such as number of rows). It is not possible to achieve the exact value. It enables the encoder to compare all possible row and column combinations and select one that produces the closest match.

In order for the encoder to calculate the aspect ratio of the symbol, the encoder has to know another parameter, yHeight, which is the height of a module vs. its width. Because this parameter only affects Aspect Ratio, it impacts only when Aspect Ratio is considered during the selection process. If you specify both rows and columns, or aspect ratio is 0, it does not have any effect.

2.3.2. yHeight

The yHeight is the height of the module vs. it width. For better decodability, yHeight should be greater than 3.0. After number of rows and columns are determined, yHeight affects the final symbol size.

If you are using font-based approach, note that yHeight is fixed per font. For example, MRV PDF417N3 has a fixed yHeight of 3.1.

2.3.3. Module Width

The module width is the width of the module. It is an important parameter that affect overall symbol quality. We will explain its selection in the next section.

2.3.4. Compact PDF417

Compact PDF417 was referred as Truncated PDF417 in previous standard. Compact PDF417 may be used where space is a primary concern and the symbol damage is unlikely, such as in an office environment. It removes the right row indicator, and reduces the stop pattern into a single bar.

Figure 2.2. Example Compact PDF417 symbol

Example Compact PDF417 symbol

2.4. Module Width

The module width, sometimes also referred as X dimension, is the smallest length in a PDF417 symbol. It must be printed correctly otherwise you will end up with a low quality, or even worse, an unreadable barcode.

Through the API provided by our software, you can create either vector graphic files or raster graphic files. Barcode string via font-based approach is a form of vector graphic. Regardless the graphic format to use, eventually images are converted into individual pixels on a printer. Therefore, the resolution of the printer has quite an impact on the dimension planning

On 600-dpi printers, a pixel is approximately 1.5 mils in width and height. This size is quite small compare to the resolution of a barcode scanner (> 5mils). Obviously loss or addition of a printer pixel does not affect the result, as the scanner is unable to find out. However, when you print on low resolution printers, such as thermal printers or fax machines, the selection of the lengths must be planned carefully. A typical thermal printer's resolution is 203 dpi, which means that the width of a printer pixel is about 5 mils, large enough to affect the printing quality.

when working on lower resolution printer, the module width should be set to a value that produces integral times of pixels on target printers. Note that images may undergo transform and its dimensions may alter during the process from that they are created to that they are finally rendered on the printer. A typical scenario is that an image is created but scaled up or down at a later time. The barcode image may look prefect to human eyes, but renders poorly on the printer.

When rendering vector graphic images, our encoder also asks for the target printer resolution parameter, to ensure that the lengths will render consistently on the target printer. When rendering raster graphic images, the encoder asks for the number of pixels per X dimension. Special care should be paid to avoid loss or addition of pixels during the rendering process.

When you are printing on a low resolution printer, such as a 203-dpi thermal printer, or 300-dpi ink-jet printer, make sure that the X dimension is integral times of the pixel size. Follow the steps below to determine the best X dimension for your printer:

  1. First multiply nominal X dimension (in inches) by the printer resolution. Assuming that the nominal X dimension is 15 mils and you are printing on a 300-dpi printer. The result will be 0.015*300 = 4.5.

  2. Round this value to the closet integer. In this case, the round integer is either 4 or 5. We use 4.

  3. Divide the result by the printer resolution to get the actual X dimension. In our case, it is 4/300 = 0.013 inch, or 13 mils.

  4. 13 mils is the optimal X dimension for this printer. From Table 2.1, “List of PDF417 fonts”, we know that MRV PDF417 N3 produces PDF417 barcodes at 13 mils at 12 points. If we go with font-base solution, we use MRV PDF417 N3 at 12 points.

2.5. Working with PDF417 Fontware & Writer SDK

Previous PDF417 fontware support creating PDF417 barcodes using font-based approach only. This version supports several methods creating barcodes. You should become familiar with each approach, and choose the one best fit for your working environment.

2.5.1. Font-Based

Creating barcodes using fonts involves two distinct processes: encoding and rendering. Rendering is to choose the appropriate font and font size and format the encoding results. Encoding is to convert the data into a special string, a.k.a. Barcode String, which becomes a barcode after being formatted with an appropriate font.


PDF417 fonts are not intended to apply on the text encoded directly. You must generate the barcode string first, and format the string with the font to create a valid PDF417 barcode.

The Font-based approach is easy to understand, and in some occasions the only way to add barcode printing functionality, such as in Crystal Reports.

The drawing below illustrates how you create a PDF417 symbol using font-based approach. You first create the barcode string (which is an array of text lines). Format the barcode string with MRV PDF417 N3 font you get the barcode. Encoding

To create a valid barcode, you need to call an encoder to get a special string, and format this string with our PDF417 font. To get this string, you need to call an encoder - you can run PDF417 Encoder GUI, and obtain the result from this GUI program. Or if you need to bulk generate the results, using the programming interface exposed from the encoder DLL.

PDF417 Encoder GUI

This GUI program allows you to quickly create barcode string and transfer it to other programs. You are able to enter the data encoded, and create the barcode on the fly. For more information, see Chapter 3, Using Encoder GUI.


This DLL is a standard Windows DLL that can be called by many programming environments, including Microsoft Office, C++, FoxPro and .Net. Most programming environments support Windows DLL directly. We provide a VBA module and a C# class that wrap around the DLL functionality.


This DLL is specifically designed for Crystal Reports. For more information on using the software with Crystal Reports, see Chapter 7, Adding PDF417 Symbols to Crystal Reports. Font Characteristics

In this package four fonts are provided, as below:

Table 2.1. List of PDF417 fonts

FilenameTypefacey-heightX-dim at 12 points
mrvpdf417n2.ttfMRV PDF417 N2yHeight: 2.120 mils
mrvpdf417n3.ttfMRV PDF417 N3yHeight: 3.113.35 mils
mrvpdf417n4.ttfMRV PDF417 N4yHeight 4.210 mils
mrvpdf417n6.ttfMRV PDF417 N6yHeight 6.26.67 mils

Note that y-height is fixed per font. Generally speaking, font MRV PDF417 N3 is recommended to use. MRV PDF417 N2 should only be used when you have complete control on the full process, i.e. a closed system.

Using font you change the barcode size by increasing or decreasing font size. Font scales linearly on both directions. Advantages and Disadvantages

Fonts are supported by many applications. It is often the most easiest and straightforward method to add barcode printing function to a document, report or custom program. The barcode string can be stored and transferred to another platform. Troubleshooting is straightforward by examining text strings.

On the other side, font-based approach relies on rendering software to turn the drawing command into pixel at the time of print. Some software may not rasterize fonts properly. PDF417 fonts require the line height properly calculated to avoid line gaps (must be 0), which is not always the case. Some software allow you to adjust the line gap, but many do not provide such an option.

Not all sizes will produce optimal size barcodes, especially when printed on low resolution printers. See the chapter followed on notes working on low resolution printers, such as a fax machine.

Font-based approach also relies on the PDF417 fonts, which provide limited choices of y-height as y-height in each font is fixed.

In case that you can't get the font work on an application, you have two other options - standard image files and ActiveX control.

2.5.2. Image File Based

You can export barcodes as standard image files to be consumed in other word processing and imaging programs. The PDF417 Encoder GUI supports exporting images in five formats via a GUI interface. The Encoder DLL and PDF417 ActiveX Control also provides programming interfaces to export images in those formats:

  • PNG (Portable Network Graphics)

  • BMP (Windows Bitmap File)

  • EMF (Ehanced Meta File)

  • SVG (Scalable Vector Graphics)

  • EPS (Encapsulated PostScript)

Special attention should be paid when the target printer has low resolution, such as a thermal printer or fax machine. When generating vector graphics files, the software allows you to specify target dpi which you should set to the one that matches your printer. It is generally not recommended to scale the image down or up when working with low-resolution printers.

PDF417 Font Encoder DLL provides a method to retrieve a Windows enhanced metafile (EMF) handle that can be used to print to printers. The PDF417 ActiveX control provides a similar feature through its Picture property.

2.5.3. ActiveX Control

For environments that support ActiveX Controls (also called OLE controls), you can insert the PDF417 ActiveX Control into documents, spreadsheets, or invokes the control at the background in your program. With ActiveX Control you are able to change the barcode image by editing its properties.

Using ActiveX Control in Microsoft Office programs is straightforward. Programming knowledge is required in order to integrate the control with your custom programs.

2.6. Solution Quick Reference

Morovia PDF417 Fontware & Writer SDK 4.0 was conceived as a Swiss knife for adding PDF417 barcodes to a wide range of programming environments and applications. Use the following list to quickly locate the solution for your environment.

C++ Application

Both font-based and ActiveX-based solutions are supported in C++. ActiveX control can be invoked at background.

Example C++ code are included in this release. See the files under CSample folder in the program directory. The PDF417EncodeC.cpp contains code that dynamically loads the dll and calls the functions. The PDF417EncodeC2.cpp uses VC++ pragrma to link to the import library. If you have Visual C++ installed, you can run build.bat on command prompt to build the executable.

Microsoft Word

It is recommended to insert the barcode using ActiveX control so that you can change the barcode easily at later time. You can also invoke GUI encoder and paste the results in either RTF or EMF formats into Microsoft Word.

Microsoft Excel

You can use PDF417 ActiveX control in Excel and link data to be encoded with a cell. Refer to Section 4.3, “Excel (ActiveX Control)” for more information.

Mail Merge

If you currently store data in a database (typically Excel spreadsheet), and need to print labels with PDF417 barcodes, you can use Word Mail Merge to pull the data and print them out. Section 4.5, “Word Mail Merge” explains how to do so.

Microsoft Access

Both font and ActiveX control can be used in Microsoft Access reports. See Section 4.1, “Access (ActiveX Control)” for using PDF417 control, and Section 4.2, “Access (PDF417 Font)” for font-based solution.

Crystal Reports

PDF417 barcodes can be easily added to Crystal Reports 9.0 and above using UFL. See Chapter 7, Adding PDF417 Symbols to Crystal Reports for more information.

SQL Server Reporting Service (SSRS)

This product includes a SSRS custom assembly that adds PDF417 barcode printing functionality to Reporting Service. See Chapter 8, Adding PDF417 Symbols to SQL Server Reporting Service for details.

Visual Basic 6

Both font-based and ActiveX approaches can be used in Visual Basic 6. A sample project is included in the software.

.Net (All versions)

Both Font encoder DLL and ActiveX control can be used in .Net programming environment with the help of interoperability. The software includes examples written in C# on both approaches. Note: the software includes only 32-bit ActiveX control by default. Using font encoder dll is encourage because both 32-bit and 64-bit versions are included in the software.


Java applications can access Encoder functions through Java Native Access(JNA).

Delphi, Foxpro, Powerbuilder and more

Although we do not officially support those programming environments due to lack of software in our lab. However, based on our support experience, our software fully support these programming languages (both DLL and ActiveX control).

Currently, the software requires Windows 2000 or above to function. We are able to compile the encoder DLL on other platforms such as Mac OS/X and Linux. If you need a solution to work on those platforms, write to for more information.

Could not locate your specific needs? You are welcome to email our support engineer at . Before you do, you might want to visit our site first to see if your concern has been addressed. make sure that you concern has been visited by us. Search Morovia Knowledge Base and Community Forums first. It is possible that your question has been addressed.

[2] The algorithm is described in Annex E, User selection of error correction level, ISO/IEC 15438:2006.

[3] Worse, it might give you a false impression that your barcode is more error-resistant because it is larger.