25.2. Creating barcodes

25.2.1. Introduction

The library allows the creation of PDF417 barcodes as either images (in either PNG or JPEG format) or as a Postscript files. In addition the barcode extension provides extensive data verification which makes it impossible to create an invalid barcode


The JpGraph PDF417 barcode module have been extensively verified using an ARGOX 8213 2D CCD handhold scanner.


This is a summary of the features available in the JpGraph PDF417 barcode extension.

  • Supports both standard and truncated PDF 417 codes

  • Output format

    1. Image format, (any of the formats supported by the library)

    2. Postscript

    3. Encapsulated postscript

  • Supports both auto and user selectable number of columns and rows

  • Supports all 8 possible error correction levels

  • Supports all defined compaction schemes, Alpha, Numeric and Byte. In addition the library has an optimization algorithm that will determine the best possible encoding given a specific input data.

  • User specified module height

  • User specified module width factor

  • User specified overall image scaling of resulting barcode

  • Horizontal or vertical barcode layout

  • Optional human readable text at the bottom of the barcodes with selectable font and size

  • Foreground and background color specification

Sample application

Even though the library module is meant, and designed, to be used as a library within a larger system there is a small demo barcode creation application included in the distribution. This application can be used to easily create barcode through it's WEB interface as can be seen in Figure 25.3

This application is primarily included as a demo on the features available in the library and not as a finalized product.

The application is available at "pdf417/demoapp/index.html" in the distribution.

Figure 25.3. PDF417 WEB-based demo application

PDF417 WEB-based demo application

The fields in the demo application has the following meaning

  • Data: Data to be encoded. This should be entered as a standard string.

  • Encoding: Determine the compaction schema to be used

  • Columns: Number of data columns to be used

  • Error level: What error level to be used

  • Module width: Module width

  • Height factor: Specify the height of the individual rows in the barcode as a multiplier of the width.

  • Scale: Scale factor.

  • Text: Should the human readable text be shown?

  • Vertical: Should the barcode use vertical layout?

  • Frame: Should a frame be added to the barcode?

  • Truncated: Should the barcode be truncated?

  • File: If specified the output will be written to this file

  • PS Module: If specified will be used as the module width for PS

  • Format: If specified will set what image encoding will be used output

  • Debug info: Will open a new frame and display some internal debugging information from the library.