How to create, print UPC-A in Eclipse BIRT reports?
Using BIRT Barcode Generator plugin to generate UPC-A in Eclipse BIRT reports
In this page, we will learn how to generate UPC-A barcodes within Eclipse BIRT (Business Intelligence and Reporting Tools) reports. UPC-A (Universal Product Code version A) is a 12 digit linear barcode symbology widely used in retail and point of sale systems across North America. It is also known as GTIN-12, GS1-12, UCC-12, or simply the UPC Code. UPC-A can be extended with 2-digit or 5-digit add on symbols (UPC A+2, UPC A+5) for supplemental information such as issue numbers or suggested retail prices.
The BarcodeLib BIRT UPC-A Generator is an Eclipse BIRT Custom Extended Report Item built on the BarcodeLib Java Barcode Generator library. It enables you to generate high quality UPC A barcode images directly in BIRT reports without writing Java code. All UPC A property settings are configured in the Report Item Property view of your Report Design file (.rptdesign). The plugin supports standard UPC-A, UPC-A with 2-digit add on, and UPC-A with 5-digit add on. It automatically calculates the mandatory MOD 10 check digit, and it provides extensive customization options for quiet zone indicators, digit spacing, vertical positioning, font size ratios, and image output formats.
BIRT Barcode UPC-A Generator Introduction
The BarcodeLib BIRT Barcode UPC-A Generator is an Eclipse BIRT Custom Extended Report Item that allows you to easily generate and print high quality linear (1D) and two dimensional (2D) barcodes in your BIRT reports. The UPC-A component specifically targets the UPC-A symbology, which is valued for its simplicity, fixed length, and global acceptance in retail.
Valid data scope for UPC A encoding:
- Numeric digits only: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
- The data must consist of exactly 11 or 12 digits. If 11 digits are provided, the library automatically calculates the 12th digit as the MOD 10 check digit. If 12 digits are provided, the library validates the check digit and throws an exception if it is incorrect.
How to Generate UPC-A in a BIRT Report
This section provides a step by step guide to generating and printing UPC A barcodes in a BIRT report.
- Open the Palette view and add the barcode report item
- Edit the barcode parameters
Right click the barcode item you have added and select Properties from the context menu. This opens the General tab, where you will find all barcode properties.
- For static text data, enclose the value in double quotation marks (e.g., "12345678901").
- For data set expressions, do not use quotes; instead, enter an expression such as row["PRODUCT_CODE"].
- Preview the report
Click the Preview button (or View Report) on the toolbar. A UPC-A barcode image should be printed on your BIRT report. The example output shows a standard UPC-A barcode
UPC A Barcode Customization in BIRT
You can customize UPC A display properties in the Report Item Property view to meet design and scanning requirements. These settings integrate with BIRT's Style and Master Page layout rules. The following customization options are available.
UPC-A Quiet Zone Indicator
The quiet zone is the blank area on the left and right sides of the barcode. UPC A requires a quiet zone of at least 11 modules. Some specifications allow a small marker (a short vertical line) at the edge of the quiet zone to indicate its boundary. The Show Quiet Zone Indicator property controls whether these markers are displayed.
- Default value: true (displays the quiet zone indicator).
- To hide the indicator: set Show Quiet Zone Indicator = false. This is often preferred for cleaner label designs.
UPC-A First and Last Digit Customization
UPC-A barcodes have the first digit (the leftmost digit of the 12 digit number) positioned slightly to the left of the barcode, and the last digit positioned to the right. By default, the library uses standard spacing and positioning. However, you can adjust the horizontal offset, vertical position, and font size of these digits using the following properties:
- UPCEANLeadDigitSpace : Sets the horizontal space (in pixels) between the first digit and the start bar (the leftmost bar of the barcode). Positive values increase the gap. Default is 0.
- UPCEANTrailDigitSpace : Sets the horizontal space (in pixels) between the stop bar (the rightmost bar) and the last digit. Positive values increase the gap. Default is 0.
- UPCEANLeadDigitYShift : Adjusts the vertical position of the first digit relative to the other digits. Positive values move the digit upward; negative values move it downward. Default is 0.
- UPCEANTrailDigitYShift : Adjusts the vertical position of the last digit relative to the other digits. Positive values move it upward; negative values move it downward. Default is 0.
- UPCEANLeadTrailDigitSizeRatio : Scales the font size of the first and last digits relative to the font size of the middle digits. For example, a value of 0.8f makes the first and last digits 20% smaller than the middle digits. A value of 1.2f makes them 20% larger. Default is 1.0f.
Extreme values may cause the digits to overlap with the bars or drift too far away, confusing the scanner. After making adjustments, always test the generated barcode with a physical scanner.
Note
These properties affect only the HRI text, not the encoded barcode pattern. They are useful for aligning the barcode with other elements in your Master Page layout or for meeting specific retail label requirements.
UPC A Check Digit Calculation and Validation
UPC-A uses a mandatory MOD 10 (module 10) check digit algorithm to ensure data integrity. The check digit is the 12th digit of the barcode. The BarcodeLib library automatically calculates and validates the check digit. This section explains the algorithm and how to use it in BIRT reports.
MOD 10 Check Digit Algorithm (for informational purposes)
- Starting from the rightmost digit (the 11th digit, just before the check digit), assign positions from right to left as odd/even. The rightmost data digit is considered odd.
- Sum all digits in odd positions (positions 1, 3, 5, 7, 9, 11 from the right).
- Multiply that sum by 3.
- Sum all digits in even positions (positions 2, 4, 6, 8, 10 from the right).
- Add the two results together (odd sum x 3 + even sum).
- The check digit is the number that makes the total sum divisible by 10. If the remainder of the sum modulo 10 is r, the check digit is (10 - r) mod 10. If r = 0, the check digit is 0.
Summary
Here we have learned how to generate, print UPC A barcodes in BIRT reports for Eclipse Java projects. All UPC-A properties are configured in the Report Item Property view of the barcode report item, ensuring consistency and ease of management across your BIRT reports.
Using the BarcodeLib UPC-A BIRT Generator, you can customize UPC-A encoding, add on symbols, dimensions, and display properties to meet your BIRT report's specific requirements, whether for retail product labels, inventory management, or point of sale documentation. The plugin is mature, redistributable as a single JAR, and requires no registration key.