14.15. PDF 417

Figure 14.1. A sample PDF417 barcode

A sample PDF417 barcode

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.

The data is encoded using one of three compaction modes: Text compaction mode, which encodes alpha-numeric characters and punctuations; Binary compaction mode, which encodes all 8-bit characters; Numeric compaction mode, which achieves the highest density by only allowing digits. The default mode is Text compaction mode. Using special code words, the compaction mode can be switched from one to another. Barcode ActiveX automatically selects the compaction mode based on data encoded and shifts accordingly.

Each PDF417 symbol contains 2 to 512 error correction code words corresponding to error correction level 0 (the least) to 8 (the highest).

14.15.1. Security Level

In PDF417 the security level is selectable. You can specify a value between 0 and 9 for PDF417SecurityLevel. Value 9 means automatic and the program selects the security level based on the data encoded and the recommendation from the PDF417 specification.

14.15.2. Size Control

There are several properties determining the size and the shape of the symbol. PDFMaxRows sets the maximum number of rows allowable and PDFMaxCols sets the maximum number of columns. A PDF417 symbol can have 30 columns and 60 rows. It should be pointed out that the row and column here really mean code words, instead of modules. The width of the representation of a code word is much longer than its height. Value 0 allows Barcode ActiveX to select the value based on the amount of the data and the aspect ratio.

The data capacity is directly linked to the number of columns and rows. Setting PDFMaxRows and PDFMaxcols to small values results smaller data capacity. When the program is unable to encode the data within the limits, an error is reported.

Other related properties include PDFModuleHeigth, PDFModuleWidth and PDFAspectRatio. The smallest unit in a PDF417 symbol is called a module. The PDDFModuleWidth and PDFModuleHeight reflect the height and width of the module respectively.

PDFAspectRatio impacts the shape of the final symbol. The PDFAspectRatio is defined as the ratio of the height to the overall width of the symbol. Barcode ActiveX locates the solution that close matches the specified value. Note: in many cases to match the aspect ratio Barcode ActiveX has to increase the overall symbol size. Smaller PDFAspectRatio value usually produces more compact symbols.

PDFAspectRatio=0.5 (default) PDFAspectRatio=0.2 PDFAspectRatio=1.0

14.15.3. Input Format

PDF417 is capable of encoding all characters with ASCII values between 0 and 255. Depending on programming environment you may need tilde codes to escape some characters.

When creating PDF417 barcodes you can use the following tilde codes:

~dnnn

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.

~2

Indicates that a MacroPDF417 control block follows. The ~2 tilde codes format is a Morovia extension.

~3

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

~X

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 ...

14.15.4. Truncated PDF

In a relatively clean environment where label damage is not likely, the right column indicators can be omitted and the stop pattern can be reduced to one module bar. This truncation reduces the data overhead and saves some space at the cost of performance and robustness.

Figure 14.2. A sample truncated PDF417 barcode

A sample truncated PDF417 barcode

To produce truncated PDF417 symbols, set the property PDF417TruncatedSymbol to TRUE.

14.15.5. Global Label Identification (GLI)

GLI was introduced to allow output data stream to have interpretations different from the default character set (ISO8859-1). Since version 3.2, Barcode ActiveX has been capable of encoding GLI values. A GLI can be any number between 0 and 999999. The tilde code sequence ~7nnnnnn is used to enter the ECI value. The tilde code sequence can appear at any places of the input, provided that exact 6 digits follows ~7. For example to start an interpretation 10, enter ~7000010.

14.15.6. Macro PDF417

Using Macro PDF417, large amount data are splitted into several file segments and encoded into individual symbols. To create Macro PDF417 symbols, you need to enter the control block information using ~2 tilde code sequence. A sample input looks like this:

12345678901234567890~2[3][LA-CONFIDENTIAL][6][fn:part2|ts:199044|ad:Justin Power|fs:110990]

Syntax

The tilde code sequence for Macro PDF417 control block information is as follows:

~2[SI][FID][TS][fn:string|...]

The ~2 must appear at the end of the message. The data after the control block is ignored. The first three fields are required. The last field is optional and can contain several additional sub-fields.

Segment Index (SI)

In Macro PDF417, each symbol represents a segment of the whole file. To rebuild the whole file, the segment must be constructed in proper order. The value of segment index is 0 based. For example, for a file divided into k segments, the segment index can be any number between 0 and k-1.

The value allowed for SI is between 0 and 99.

File ID (FID)

All symbols belong to the same group have the same file ID. The File ID can be any string, such as archive2. Although the standard does not set a limit on the length of the File ID, keep in mind that the control block reduces the overall symbol capacity.

Total Segments (TS)

The “total segments” field is required for every symbol in the group. It should remain constant among all symbols.

Optional Fields

Macro PDF417 defines several optional fields to encode additional file information such as file name, timestamp, file size and checksum. All these fields must be at the end of the control block. If more than two optional fields are present, they should be separated with vertical bars |. Within a field, a colon : divides the name part and value part.

The acceptable field names are listed below:

Table 14.5. Optional Fields in Macro PDF417

Field Designator Field Name (abbreviated) Field Name (normal) Comment Data Type
0 fn filename File Name string
1 sc segmentcount Segment Count number
2 ts timestamp Time Stamp number
3 sd sender Sender string
4 ad addressee Addressee string
5 fs filesize File Size number
6 cs checksum Checksum number

For example, [fn:archive1.zip|ts:20051231|sd:user@example.com|cs:9901234] encodes 4 optional fields: file name (archive1.zip), time stamp (20051231), sender (user@example.com) and checksum (9901234).