JasperReports PDF-417 Generator Library

Java Barcode Generator Library to create, print PDF-417 images in JasperReports, iReport reports

PDF-417 for iReport plugin generate, create PDF-417 barcode in iReport Jasper Reports

  • Generate, print PDF 417 matrix barcode images in iReport reports
  • Easy to redistribute iReport PDF 417 barcode library (jar)
  • Creating high-quality PDF-417 barcodes in Png, Jpeg, Gif image formats in iReport
  • Draw multiple PDF-417 barcodes in iReports with data from database
  • Completely developed in NETBeans iReport Custom Extended Report Item framework.
  • No need for registration key, activation code or barcode fonts
  • Mature iReport PDF 417 barcode generation plugin using Java Barcode Generator library

iReport Barcode PDF 417 Generator Introduction

Top
iReport Barcode is a NETBeans iReport Custom Extended Report Item which helps you easily generate and print high quality 1D (linear) and 2D (matrix) barcodes in your iReport reports.

Barcode PDF 417 Introduction

PDF 417 is a stacked linear bar code symbol used in a variety of applications, primarily transport, identification cards, and inventory management. PDF stands for Portable Data File. The PDF417 symbology was invented by Dr. Ynjiun P. Wang at Symbol Technologies in 1991.

iReport PDF 417 Generator - Valid Data Scope

  • all 128 characters of ASCII
  • values 128-255 in accordance with ISO 8859-1. There are referred to as extended ASCII

PDF-417 Generators

OnBarcode provides several PDF-417 Generator components and software, including PDF-417 Generator .NET, PDF-417 Generator Java, PDF-417 Generator C#, PDF-417 Generator VB.NET, PDF-417 Generator Android, PDF-417 Generator.
In this page, we will explain how to create, print PDF-417 in JasperReport reports using Jaspersoft Studio (official Eclipse-based report designer) or iReport Designer (legacy Swing-based report designer).

Here's a list summarizing the full content to help you quickly grasp the core points:
  • Basic steps to quickly generate PDF-417 (Barcode Component) in a JRXML (XML source template file) using Jaspersoft Studio or iReport Designer, including configuring core properties and exporting the barcode.
  • Detailed explanations of PDF-417's valid character sets, data encoding modes, and maximum data length, integrated with JasperReport's DataSource (data provider for the report) and Expression features.
  • Step-by-step tutorials for encoding different text types in PDF-417 (ASCII text, non-printable characters, Unicode text, binary data, GS1 messages, ECI mode), with clear property settings in the Report Item Property panel.
  • Customization of PDF-417 dimension settings (width, height, module size, margins) in JasperReport reports, combined with JasperReport's Formatting & Style terms (e.g., UOM, Margin).
  • Advanced PDF-417 feature configurations, including Error Correction Level (ECL), Compact (Truncated) PDF-417, and Macro PDF-417, with practical operation steps and JasperReport term integration.






How to generate PDF-417 barcodes in iReport?

Top
This is a sample to create PDF-417 barcode in iReport. More dtails, view here: how to generate and print barcodes in iReport reprts.

One more guide for you to stream PDF-417 barcodes in iReport using Java Barcode Generator buildin Servlet web application.
  1. Create a new report in iReport, and add barcode.jar to report classpath from the downloaded trial package
  2. Click "Cancel" button, in "Select an image file" window
  3. Right click on the image and edit its "Properties", and set property "Expression Class" to "net.sf.jasperreports.engine.JRRenderable";
  4. To input PDF-417 barcode data manually, set property "Image Expression" to "new com.onbarcode.barcode.jasper.JasperRenderer(
    com.onbarcode.barcode.jasper.BarcodeGenerator.draw(101, "12345", "", "X=2&Y=60"))
    "
  5. To print PDF-417 with data from database, please set property "Image Expression" to "new com.onbarcode.barcode.jasper.JasperRenderer(
    com.onbarcode.barcode.jasper.BarcodeGenerator.draw(101, $F{data field} + "", "", "X=2&Y=60"))
    ";

    BarcodeGenerator.draw method accepts 4 parameters:
    the second is the barcode data to encode, in String,
    the last is the barcode settings String. More details about barcode settings string, please check the PDF-417 property table below




PDF-417 Barcode Data Characters Encoding in JasperReport Reports

To generate a valid, scannable PDF-417 in JasperReport reports, it's critical to understand its encoding rules. Including valid character sets, data encoding modes, and maximum data length.


PDF-417 Valid Character Set

PDF-417 in JasperReport reports supports a range of character sets, which can be flexibly used with JasperReport's DataSource and Field features for dynamic data binding. The supported character sets are:
  • Full ASCII (128 characters): This includes 95 printable characters and 33 control characters (non-printable). It covers standard letters, numbers, symbols, and control codes.
  • Extended ASCII: Values 128-255 in accordance with ISO 8859-1. This supports additional characters such as accented letters, common in non-English languages.
  • Up to 811,800 different character sets or data interpretations: This flexibility allows PDF-417 to adapt to various international and industry-specific requirements.
  • Various function codewords for control purposes: These codewords manage encoding behavior and data structure, ensuring compatibility with different scanning systems.
Note: When encoding non-ASCII character sets, ensure the DataMode is set correctly to avoid encoding errors.


PDF-417 Data Encoding Mode

PDF-417 supports three compact encoding modes to optimize data storage. The JasperReports Library can automatically select the optimal mode for you, or you can manually set it in the Report Item Property panel. Here's how to configure DataMode in Jaspersoft Studio or iReport Designer:
  • Select the PDF-417 in your JRXML template.
  • Open the Report Item Property panel and locate the "DataMode" dropdown.
  • Choose the appropriate mode based on your data type. The available modes (and their use cases) are:
    • Text Compaction mode: Permits all printable ASCII characters (values 32-126 per ISO/IEC 646 (IRV)) and selected control characters. Ideal for standard text data.
    • Byte Compaction mode: Permits all 256 possible 8-bit byte values. This includes all ASCII characters (0-127) and supports international character sets via Extended ASCII or ECI mode.
    • Numeric Compaction mode: Permits efficient encoding of numeric data strings. This mode offers the highest storage efficiency for numbers (e.g., serial numbers, inventory codes).
    • PDF417DataMode.Auto: The JasperReports Library automatically selects the best mode based on the input data. This is the recommended setting for most use cases, especially when the data type varies.
  • Save the JRXML template to apply the DataMode setting.
Example configuration for automatic mode:

In the Report Item Property panel, set "DataMode" to "PDF417DataMode.Auto".Enter your data (static or dynamic via Expression) in the "Data" field. The JasperReports Library will analyze the data and select the most efficient encoding mode.

Note: Manually selecting the wrong DataMode can lead to encoding errors or inefficient data storage. Use "Auto" mode if you're unsure of the data type.


PDF-417 Maximum Data Length

The maximum data length a PDF-417 can encode depends on its encoding Data Mode and Error Correction Level (ECL). The values below apply to ECL 0 (the lowest error correction level). Higher ECLs will reduce the maximum data length slightly.
  • Text Compaction mode: 1,850 characters. Suitable for standard text and control characters.
  • Byte Compaction mode: 1,108 characters. Ideal for Extended ASCII, binary data, or international character sets.
  • Numeric Compaction mode: 2,710 characters. The most efficient mode for large sets of numeric data.
Note: If your data exceeds the maximum length for a single PDF-417, use Macro PDF-417 to split the data across multiple PDF-417 symbols.


How to Encode Text in PDF-417 Using Jaspersoft Studio/iReport

In practical report design, you may need to encode various text types into PDF-417, including ASCII text, non-printable characters, Unicode text, binary data, GS1 messages, and ECI mode data.


Generate PDF-417 with ASCII Text Encode

PDF-417 supports all 128 ASCII characters, including 95 printable characters and 33 non-printable control characters. Encoding printable ASCII text is straightforward, while non-printable characters require a specific format.
  • Non-printable control characters (e.g., [CR], [LF]) cannot be directly entered into the "Data" field. You must convert them to a specific format.
  • Convert the non-printable character to a string in the format "~ddd", where "ddd" is the three-digit ASCII value of the character. For example, [CR] has an ASCII value of 13, so it becomes "~013".
  • In the Report Item Property panel, set the "ProcessTilde" property to "true". This tells the JasperReports Library to interpret the "~ddd" format as a non-printable character.
  • Set the "DataMode" to "PDF417DataMode.Byte" (required for non-printable characters).
  • Enter the formatted string into the "Data" field (e.g., "a~013bc" to encode [CR] between "a" and "b").
  • Save the JRXML template to apply the settings.



Note: Common errors here include forgetting to set "ProcessTilde" to "true" or using the wrong DataMode (e.g., Text instead of Byte). Both will prevent non-printable characters from encoding correctly.


Generate PDF-417 with Unicode Text Encode

You can easily encode Unicode text (e.g., Arabic, Chinese, Cyrillic) into PDF-417 in JasperReport reports using the Report Item Property panel. This is useful for international reports that require non-ASCII text encoding.
  • Select the PDF-417 and open the Report Item Property panel.
  • Locate the "EncodeUnicodeText" property and set it to "true". This enables the JasperReports Library to encode Unicode text from the "Data" field.
  • Enter the Unicode text into the "Data" field. For dynamic data, use an Expression like "$F{UnicodeData}" to reference the Field storing the text.
  • Set the "DataMode" to "PDF417DataMode.Auto". The library will automatically select the optimal mode for Unicode encoding.
  • Save the JRXML template to apply the settings.



Note: If the decoded text is garbled, check that "EncodeUnicodeText" is set to "true" and the DataMode is "Auto". Also, ensure the scanner supports the specific Unicode character set (e.g., Arabic, Cyrillic).


Other Data Formats in PDF-417

PDF-417 in JasperReport reports supports additional advanced data formats, commonly used in business and industrial scenarios.
  • Binary data: Encode binary data (e.g., file byte arrays, encrypted data) by setting "DataMode" to "PDF417DataMode.Byte" and using the "ProcessTilde" property to format byte values as "~ddd". Bind the binary data to a Field ($F{}) with a BLOB type from a JDBC DataSource.
  • ECI mode data: To encode data using the Extended Channel Interpretation (ECI) protocol (for international character sets), enable ECI mode in the Report Item Property panel and select the appropriate ECI code for your character set. This is useful for encoding non-ISO 8859-1 characters.



PDF-417 2D Barcode Dimension Width and Height Settings in JasperReport Reports

You can fully customize the dimension size of PDF-417 in JasperReport reports, including module size, row/column count, margins, and unit of measure.

The following settings are available in the Report Item Property panel to customize PDF-417 dimensions.
  • UOM (Unit of Measure): Select the unit for dimension settings: PIXEL, CM, or INCH. Default is PIXEL.
  • X: Width of the bar module (the smallest unit of the barcode). The minimum width is defined by your application's specifications (typically 2-5 pixels).
  • XtoYRatio: The ratio of bar width (X) to bar height. Default value is 0.3333333f (1:3 width-to-height ratio).
  • RowCount: Number of rows in the PDF-417 symbol. Valid range is 3 to 90.
  • ColumnCount: Number of data columns per row. Valid range is 1 to 30.
  • LeftMargin, RightMargin, TopMargin, BottomMargin: Quiet zone (empty space) around the PDF-417. The minimum width of each margin is 2X (twice the module width X).
  • Resolution: Image resolution (e.g., 300 DPI) for high-quality printing.



Create, Print PDF-417 Barcode with Options Using Jaspersoft Studio/iReport

JasperReport reports support advanced PDF-417 options to meet specific business needs, including Error Correction Level (ECL), Compact (Truncated) PDF-417, and Macro PDF-417.


PDF-417 Error Detection and Correction (ECL) in JasperReport Reports

Each PDF-417 symbol contains error correction codewords to detect and correct scanning errors. The Error Correction Level (ECL) is selectable in the Report Item Property panel, with higher levels providing more error correction but reducing maximum data length.

The ECL property in the Report Item Property panel controls the number of error correction codewords.
  • ECL 0: 2 error correction codewords (lowest level, maximum data length)
  • ECL 1: 4 error correction codewords
  • ECL 2: 8 error correction codewords
  • ECL 3: 16 error correction codewords
  • ECL 4: 32 error correction codewords
  • ECL 5: 64 error correction codewords
  • ECL 6: 128 error correction codewords
  • ECL 7: 256 error correction codewords
  • ECL 8: 512 error correction codewords (highest level, minimum data length)
Locate the "ECL" property and select the desired Error Correction Level (e.g., ECL 2 for moderate error correction).

Note: Choose an ECL based on your use case. For example, use ECL 0 for indoor, low-risk environments; use ECL 4+ for outdoor or high-damage environments (e.g., product labels exposed to weather).


How to Create Compact (Truncated) PDF-417 Barcodes

Compact PDF-417 (also called Truncated PDF-417) is a condensed version of PDF-417, designed for space-constrained reports. It removes the right-row indicator and stop pattern, reducing overall size. It is ideal for scenarios where space is a primary concern and symbol damage is unlikely.

Locate the "Truncated" property and set it to "true" to enable Compact PDF-417.



Note: Compact PDF-417 is more susceptible to damage. Avoid using it in high-damage environments. Use standard PDF-417 with a higher ECL instead.


Create Macro PDF-417 Barcodes

Macro PDF-417 provides a mechanism to split large data into blocks and store it across multiple PDF-417 symbols. This is similar to the Structured Append feature in QR Code and Data Matrix symbologies and is useful for encoding data that exceeds the maximum length of a single PDF-417.

Up to 99,999 individual PDF-417 symbols can be used to encode data in Macro PDF-417. Each symbol contains control information to ensure the original data is reconstructed correctly, regardless of scanning order.

  • Select the first PDF-417 in your JRXML template (for the first data block).
  • Open the Report Item Property panel and set the "MacroPDF417" property to "true" to enable Macro mode.
  • Configure the following control properties:
    • MacroSymbolCount: The total number of PDF-417 symbols needed to store the entire data message (e.g., 3 for splitting data into 3 blocks).
    • MacroSymbolIndex: The position of the current PDF-417 in the sequence (starts at 0 for the first symbol).
    • MacroFileId: A unique identifier (integer) for all symbols in the same Macro PDF-417 set. All symbols must have the same MacroFileId.
  • Enter the portion of the data to encode in the current PDF-417 (e.g., the first 1,000 characters for MacroSymbolIndex 0).
  • Repeat the process for each additional symbol (add new Barcode Components to the report, adjust MacroSymbolIndex for each, and keep MacroFileId consistent).
  • Save the JRXML template to apply the settings. You can use a Subreport (Embedded nested report) to organize multiple Macro PDF-417 symbols in a single report.



Note: Ensure all symbols have the same MacroFileId and correct MacroSymbolIndex. Incorrect settings will prevent the scanner from reconstructing the original data.

iReport Barcode PDF-417 Generator - Property Settings

Top
Category Properties Value Comments
Basic Property: Data Type: expression
Default: ""
  • If you encode the barcode data text directly, the text string should be around by " " ", such as "12345"

  • If you encode the barcode data from dataset, input the expression, such as row["CUSTOMERNUMBER"]
Barcode value to encode

PDF-417 Valid Data Char 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.

 
PDF 417
Special
Property: Process Tilde Type: boolean
Default: true
Set the Process Tilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is true.
  • 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126
    Strings from "~256" to "~299" are unused
  • 2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
    Strings from "~665536" to "~699999" are unused
  • Programming for reader initialisation: ~rp.
    This should be located at the beginning of the encoding data, e.g. data = "~rpABCD1234".
  • ECI: ~7dddddd (valid value of dddddd from 000000 to 999999)
Property: PDF 417 Data Mode Type: int
Default: AUTO
Valid values:
  • AUTO
  • TEXT
  • BYTE
  • NUMERIC
Property: PDF 417 Error Correction Level Type: int
Default: 2
Error correction level, values are from 0 to 8.
Property: PDF 417 Row Count Type: int
Default: 3
The number of rows for PDF417. The value range is from 3 to 90. The default is 3.
Property: PDF 417 Column Count Type: int
Default: 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.
Property: PDF 417 Truncated Type: boolean
Default: false
truncated PDF417 may be used where space considerations are a primary concern and symbol damage is unlikely.
Property: 2D Barcode Structured Append Type: boolean
Default: false
Set Structured Append property to true, then Structured Append is enabled.
Property: 2D Barcode Symbol Count Type: int
Default: 0
Set Symbol Count property to the number of total symbols which make the sequence.
Property: 2D Barcode Symbol Index Type: int
Default: 0
Set Symbol Index property to the position of current symbol in the secuence (Start with 0).
Property: 2D Barcode File Id Type: int
Default: 0
Set File Id property to be identified to the same file.
 
Barcode
Size
Related
Property: Unit of Measure Type: int
Default: 0 (pixel)
Unit of meature for all size related settings in the library.
Valid values: 0: pixel; 1: inch; 2: cm.
Property: X Type: float
Default: 1
Width of barcode bar module (narrow bar), default is 1 pixel
Property: Y Type: float
Default: 30
Height of barcode bar module, default is 30 pixel
Property: Left Margin Type: float
Default: 0
Barcode image left margin size.
Property: Right Margin Type: float
Default: 0
Barcode image right margin size.
Property: Top Margin Type: float
Default: 0
Barcode image top margin size.
Property: Bottom Type: float
Default: 0
Barcode image bottom margin size.
Property: Resolution (in dpi) Type: int
Default: 72
Barcode image resolution in DPI (Dots per inch).
Property: Rotate Type: int
Default: 0 (rotate angle in 0 degree)
Valid values:

  • 0 (rotate angle in 0 degree)
  • 90 (rotate angle in 90 degree)
  • 180 (rotate angle in 180 degree)
  • 270 (rotate angle in 270 degree)
 
Font
Style
Property: Show Text Type: boolean
Default: true
If true, display barcode data text under the barcode, otherwise do not display.
Property: Text Font Size Type: int
Default: 11
Barcode text font size.
Property: Text Margin Type: float
Default: 6
Space between barcode and barcode data text, default is 6 pixels


Summary

This guide has provided a comprehensive, step-by-step approach to generating and customizing PDF-417 in JasperReport reports using Jaspersoft Studio or iReport Designer. We covered all key aspects, including basic generation, data encoding (standard and advanced), dimension customization, and advanced options like Error Correction Level, Compact PDF-417, and Macro PDF-417.







































Start with free trial package:








































Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.