barcodelib.com Home
  Contact Us  |   Purchase  
Google
BarcodeLib.com Home > Products > Barcode for Java > Barcode PDF 417


PDF417 Barcode for Java, J2EE, JasperReports

It is also known as Portable Data File 417, PDF 417, PDF417 Truncated

Quick Navigate
PDF417, or Portable Data File 417, is a two-dimensional stacked barcode symbology capable of encoding over a kilobyte of data per label. It was developed by Symbol Technologies (1989-1992) and is currently maintained by ANSI / AIM USA.
Large amounts of text and data can be stored securely and inexpensively when using the PDF417 symbology. The printed symbol consists of several linear rows of stacked codewords. Each codeword represents 1 of 929 possible values from one of three different clusters. A different cluster is chosen for each row, repeating after every three rows.
PDF417 is a bar code symbology with the following basic characteristics:
  1. Encodable character set:
    • Text Compaction mode permits all printable ASCII characters to be encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as well as selected control characters.
    • Byte Compaction mode permits all 256 possible 8-bit byte values to be encoded. This includes all ASCII characters value 0 to 127 inclusive and provides for international character set support.
    • Numeric Compaction mode permits efficient encoding of numeric data strings.
    • Up to 811 800 different character sets or data interpretations.
    • Various function codewords for control purposes.
  2. Symbol character structure: (n, k, m) characters of 17 modules (n), 4 bar and 4 space elements (k), with the largest element 6 modules wide (m).
  3. Maximum possible number of data characters per symbol (at error correction level 0): 925 data codewords which can encode:
    • Text Compaction mode: 1 850 characters (at 2 data characters per codeword).
    • Byte Compaction mode: 1 108 characters (at 1,2 data characters per codeword).
    • Numeric Compaction mode: 2 710 characters (at 2,93 data characters per codeword)
    At the minimum recommended error correction level, there is a maximum of 863 data codewords which can encode:
    • Text Compaction mode: 1 726 characters (at 2 data characters per codeword).
    • Byte Compaction mode: 1 033 characters (at 1,2 data characters per codeword).
    • Numeric Compaction mode: 2 528 characters (at 2,93 data characters per codeword).
  4. Symbol size:
    • Number of rows: 3 to 90.
    • Number of columns: 1 to 30.
    • Width in modules: 90X to 583X including quiet zones.
    • Maximum codeword capacity: 928 codewords.
    • Maximum data codeword capacity: 925 codewords.
    Since the number of rows and the number of columns are selectable, the aspect ratio of a PDF417 symbol may be varied when printing to suit the spatial requirements of the application.
  5. Selectable error correction: 2 to 512 codewords per symbol
  6. Non-data overhead:
    1. Per row: 73 modules, including quiet zones.
    2. Per symbol: a minimum of 3 codewords, represented as symbol characters.
  7. Code type: continuous, multi-row two-dimensional.
  8. Character self-checking: Yes.
  9. Bi-directionally decodable: Yes.
PDF417 Barcode for Java supports:
  • all 128 characters of ASCII

The following code illustrates how to create a barcode in a Java class

1            PDF417 barcode = new PDF417(); 
2            barcode.setData("123456789"); 
4            barcode.createBarcodeImage("c:/pdf417.gif"); 


  • Create a PDF417 object (line 1)
  • set PDF417 object properties (line 2)
  • save into gif file (line 4)

There are two ways to create barcode images in your Java web applications.

  1. This is the simplest way to stream barcode image using our provided barcode servlet classes.

    And it will not save barcode images in your server side.

    • Under demo package, copy barcode folder to your java servlet container like tomcat.

    • To test your installation, goto http://YourDomain:Port/barcode/pdf417?Data=123456789

    • To create barcode image in your JSP page, you can pass the url to IMG tag src value. For example, <img src="http://YourDomain:Port/barcode/pdf417?Data=123456789" />

  2. The second method is similar with the way to generate barcode in Java applications.

    • Create a barcode image in server side

      1            PDF417 barcode = new PDF417(); 
      2            barcode.setData("123456789"); 
      4            barcode.createBarcodeImage("C:/Tools/Tomcat 5.5/webapps/YourWebApp/bimages/pdf417.gif"); 
      
      
      

    • In your JSP page, you can using IMG tag to display generated image, like <img src="http://YourDomain:Port/YourWebApp/bimages/pdf417.gif" />

The following jasper xml content illustrates how to insert a barcode into JasperReports

<import value="com.barcodelib.barcode.BarcodeFactory"/> 

Import class BarcodeFactory to report.

 
<imageExpression class="net.sf.jasperreports.engine.JRRenderable"> 
    <![CDATA[new com.barcodelib.barcode.BarcodeJasperRenderer( 
        BarcodeFactory.createPDF417("0470821632", 1))]]> 
</imageExpression>

Please go to class BarcodeFactory in Java doc for all methods to create PDF417 barcode.

Developers also can extend BarcodeFactory class to meet their own requirements. Complete BarcodeFactory.java Source Code

Just call PDF417 object method createBarcodeImage, e.g. barcode.createBarcodeImage("c:/pdf417.gif");
Category Class Attribute Applet & Servlet Default Value Comments
Basic Settings
barcode Barcode "" This is the barcode text to be encoded. The type is String.
dataMode DataMode BINARY In the applet and servlet, the mode can be set to "BINARY", "TEXT" or "NUMERIC" (in String). In the class library, the mode can be set to one of the following numbers: 0=BINARY, 1=TEXT or 2=NUMERIC.
binaryCode N/A null The binary data (as byte[]) to be encoded in the barcode
ecl ecl 2 Error correction level. The value range is from 0 to 8. The default is 2. See Coefficient Table for Error Correction Levels
truncated Truncated false If true, truncated PDF417 code will be created; Default is false. A truncated PDF417 is more area efficient than normal PDF417. By selecting this option, the right hand side of the PDF417 is removed or truncated. This option should only be used in clean environments since it is less immune to damage. The servlet and applet converts "Y" to true and "N" to false.
processTilde ProcessTilde true Set the ProcessTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is true. ~NNN: is used to represent the ASCII character with the value of NNN.
Macro PDF417
macroPDFEnable N/A false Determines if the barcode being created will be part of a MacroPDF barcode.
macroPDFFileID N/A 0 Sets the id (start from 0) of the barcode in a sequence of barcodes for MacroPDF. Each MacroPDF barcode in a sequence must have the same File ID so the reader can reassemble them correctly.
macroSegmentCount N/A 0 Segments count
macroPDFSegmentIndex N/A 0 Sets the index number of this barcode in a sequence of MacroPDF barcodes.  Each barcode in the sequence must have a unique segment index. Readers will reassemble the barcode in the order of the segment index.
Image Size and Style
uom UOM 0 (pixel) Unit of measure for barcode size settings, type is float, default is 0 (pixel). Valid values are 0 (pixel), 1 (CM), 2 (Inch)
resolution Resolution 96 Image resolution. Default is 96 DPI.
columnCount ColumnCount 5 Number of columns. The value range is from 1 to 30. The default is 5. Increase this value, if your data size is large.
rowCount RowCount 0 The number of rows for PDF417. If 0 (default), the number will be calculated automatically. It is not recommended to set this number because the number of rows is automatically calculated by engine and an incorrect number can cause the symbol to be too large. Please set the PDF417 Columns to adjust the size.
barWidth BarWidth 1 The X multiple height of individual cells. This is usually set between 3 and 5. A higher number creates an easier to read, taller symbol.
barRatio BarRatio 3 The X multiple height of individual cells. This is usually set between 3 and 5. A higher number creates an easier to read, taller symbol.
leftMargin LeftMargin 0 Image left margin. Its unit of measure is decided by uom.
rightMargin RightMargin 0 Image right margin. Its unit of measure is decided by uom.
topMargin TopMargin 0 Image top margin. Its unit of measure is decided by uom.
bottomMargin BottomMargin 0 Image bottom margin. Its unit of measure is decided by uom.






   Copyright 2008 BarcodeLib.com. Provides High Quality Barcode PDF 417 for Java, Barcode PDF 417 for JasperReports Library. All rights reserved.