Putting It All Together

Let’s now take all of the data from the other sections, to create an entire PDF417 label.

From the examples, we encoded the string PDF417. The following codewords were calculated:

Data codewords d4 ,..., d0:                                                                                                                                                5,453,178,121,239

Error Detection/Correction Codewords c3 ,..., c0:                                                                                                                                                     452,327,657,619

Now we need to decide what type of aspect ratio is used for our label. Clearly, this is a user’s decision; the printer simply follows what the user specifies.

Since we have 9 codewords, we can arrange the bar code to be 3 rows of 3 codewords, or 9 rows of 1 codeword. If we need some other arrangement, we would have to pad the data codewords with null codewords (unused shift or latch characters at the end of the data).

Let’s make it 3 rows of 3 codewords.

The bar code layout would be:  

Start Pattern Lr  Data  Data  Data  Rr Stop Pattern
Lr Data Data ECC Rr
Lr ECC ECC ECC Rr

Where Lr = Left Row Indicators and Rr = Right Row Indicators and
ECC = Error Correction Codewords

From all of the sample calculations above, take the data, row indicators, and error detection/correction codewords. Substitute into the above layout to get:  

Start Pattern 0 453  178  2 Stop Pattern
5 121 239 452 0
2 327 657 619 5

Now the codewords must be converted to bar-space patterns (low-level encoding).

81111113 31111136 51111251 31312223 51211142 51111152 711311121
41111315 41131115 42113231 22163111 51111125
11111246 12211532 32411132 12361121 11111345

The entire set of codewords is divided into three mutually exclusive encodation sets, or clusters. Each cluster encodes the 929 available PDF417 codewords with distinct bar-space patterns so that one cluster cannot be confused with another. A codeword must be encoded according to the cluster used by that row.

Each row uses only one of the three clusters (0, 3, or 6) to encode data, with the same cluster repeating sequentially every third row. Row 0 codewords use cluster 0, row 1 uses cluster 3, and row 2 uses cluster 6, etc. In general, cluster number = ((row number) mod 3) *3.

Look up each value from the appropriate cluster tables, add the start pattern 81111113 to the left of the left row indicators, and add the stop pattern 711311121 to the right of the right row indicators.

The bar code bar space patterns would then be:

Codewords 5 453 178 121 239 452 327 657 619
Patterns 51111251 31312223 51211142 41131115 42113231 22163111 12211532 32411132 12361121

The resulting bar code itself is: