Section - 14 : Sizing a PDF417 Bar Code


A PDF417 bar code can represent a limited amount of data. This data is converted internally and stored in what are called code words. There is a maximum of 928 internal code words per bar code. Some of the code words are dedicated to the data content itself, and some of the code words are usually dedicated to error correction (ECC) encoding.

The ECC level can range between zero (0) and eight (8). Each increase in level requires an increase in the amount of the bar code's code words dedicated to error correction. Since there is a maximum number of code words allowed, increasing the amount of error correction decreases the maximum space available for data.

The number of code words dedicated to error correction is calculated in this fashion:

CW = 2 ** (ECC + 1)

For example:

ECC = 0, CW = 2 ** (0+1) = 2 ** 1 = 2

ECC = 1, CW = 2 ** (1+1) = 2 ** 2 = 4

ECC = 2, CW = 2 ** (2+1) = 2 ** 3 = 8

ECC = 3, CW = 2 ** (3+1) = 2 ** 4 = 16

ECC = 4, CW = 2 ** (4+1) = 2 ** 5 = 32

ECC = 5, CW = 2 ** (5+1) = 2 ** 6 = 64

ECC = 6, CW = 2 ** (6+1) = 2 ** 7 = 128

ECC = 7, CW = 2 ** (7+1) = 2 ** 8 = 256

ECC = 8, CW = 2 ** (8+1) = 2 ** 9 = 512

The NYSID requires an ECC level of at least 4, equating to 32 internal code words.

The total number of code words (up to the maximum of 928) that can be contained in a PDF417 bar code is computed by determining how many code words are represented by the number of columns in each row, and then multiplying by the number of rows.

The number of rows can range from 3 to 90.

The number of code words per row can be calculated from the specified columns using the following formula:

CW=INT(((COLS*100)+425)/425)-5

The resultant code words per row can range from 1 to 30. This puts a practical range on the number of columns per row of from 22 to 145.

There is an absolute limit to the size of a bar code of 928 internal code words. All input data and error correction information must be able to be represented by no more than 928 internal code words. Generally, two code words are always consumed by overhead.

The bar code application for the state of New York currently stores 570 characters of text into the bar code. A PDF417 bar code will compact the data somewhat. The fastest and safest method of encoding the data is called binary mode. Binary mode compacts the data by approximately a factor of 1.2. For example:

570 / 1.2 = 475 data code words

ECC level 4 = 32 code words

Overhead = 2 code words.

Total required = 509 code words

There are many size and shape combinations of PDF417 bar codes that are just large enough to represent this information. By multiplying a ROWS value times a code words per row value, it is possible to find many combinations greater than 509.

This table shows how to equate text columns to code words per row.

Text columns Internal code words
149 and more Too big
145-148 30
141-144 29
136-139 28
132-135 27
128-131 26
124-127 25
119-123 24
115-118 23
111-114 22
107-110 21
102-106 20
98-101 19
94-97 18
90-93 17
85-89 16
81-84 15
77-80 14
73-76 13
68-72 12
64-67 11
60-63 10
56-59 9
51-55 8
47-50 7
43-46 6
39-42 5
34-38 4
30-33 3
26-29 2
22-25 1
21 and less Too small

For example 30 rows times 18 code words per row equals 540, which should be large enough. And, 18 code words per row equate to 94 text columns. So, a bar code of 30 rows and 94 columns should be safely large enough for the New York application.

From the previous tables, assuming the smaller font and 300 dpi, the bar code would be 9/10ths of an inch tall and about 3 and 7/10ths inches wide.