JasperReports UPC-A Generator Library

Java UPC-A Barcode Generator Library to create, print UPC-A images in JasperReports, iReport reports

UPC-A for iReport plugin generate, create UPC-A barcode in iReport Jasper Reports

  • Professional Java Barcode Library to generate UPC-A barcodes in iReport reports
  • Simple to redistribute iReport UPC-A linear barcode library (jar)
  • Easy to use barcode tool with no registration key or activation code needed
  • Totally compatibile with latest GS1 General Specifications for valid output
  • Generating high quality UPC-A Bar Code images in GIF, Png and Jpeg image formats
  • Completely developed in NETBeans iReport Custom Extended Report Item framework.
  • Mature iReport UPC-A barcode generation plugin using Java Barcode Generator library


JasperReport Barcode UPC-A 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.

In this page, we will explain how to create, print UPC-A barcodes within JasperReport reports using Jaspersoft Studio (official Eclipse-based report designer) or iReport Designer (legacy Swing-based report designer). Here's a list of key topics covered in this page:
  • Quick steps to insert and generate UPC-A as a Barcode image in a JRXML (XML source template file) using Jaspersoft Studio or iReport Designer, including data requirements and basic configuration.
  • Guidance on customizing UPC-A barcodes in JasperReport reports, including settings for quiet zone indicators, digit spacing, digit position, and font size.
  • Step-by-step instructions for adjusting UPC-A's first and last digit properties (spacing, vertical offset, font size ratio) via the Report Item Property panel.
  • Explanation of UPC-A check digit calculation (modulo 10) and how the JasperReport Library (core Java reporting engine) handles check digit validation and generation.

Barcode UPC-A Introduction

UPC-A is also known as Universal Product Code version A, UPC-A Supplement 5/Five-digit Add-On, UPC-A Supplement 2/Two-digit Add-On, UPC-A+5, UPC-A+2, UPC Code, UPC Symbol, GTIN-12, GS1-12, UCC-12

iReport UPC-A Generator - Valid Data Scope

  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

UPC-A Generators

OnBarcode provides several UPC-A Generator components and software, including UPC-A Generator .NET, UPC-A Generator Java, UPC-A Generator C#, UPC-A Generator VB.NET, UPC-A Generator.






How to generate UPC-A barcodes in JasperReport?

Top
Please follow the steps to create a UPC-A barcode in iReport. View details here: how to generate and print barcodes in iReport reprts.

One more method to print UPC-A: stream UPC-A barcodes in iReport using Java Barcode Generator buildin Servlet web application.
  1. Create a new report, and add barcode.jar to report classpath from the downloaded trial package
  2. Drag an image item in Palette to report
  3. Click "Cancel" button, in "Select an image file" window
  4. Right click on the image and edit its "Properties", and set property "Expression Class" to "net.sf.jasperreports.engine.JRRenderable";
  5. To input UPC-A barcode data manually, set property "Image Expression" to "new com.onbarcode.barcode.jasper.JasperRenderer(
    com.onbarcode.barcode.jasper.BarcodeGenerator.draw(19, "12345678901", "", "X=2&Y=60"))
    "
  6. To print UPC-A with data from database, please set property "Image Expression" to "new com.onbarcode.barcode.jasper.JasperRenderer(
    com.onbarcode.barcode.jasper.BarcodeGenerator.draw(19, $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 UPC-A property table below




UPC-A barcode with 2-digit addon



UPC-A barcode with 5-digit addon



Print and Customize UPC-A Barcodes in JasperReport Reports

You can fully customize UPC-A barcodes in JasperReport reports to meet your report design and scanning requirements. These settings include quiet zone indicators, digit spacing, digit position, and font size adjustments.

The key customization properties for UPC-A barcodes in JasperReport reports are:
  • ShowQuietZoneIndicator: Controls whether to display or hide the UPC barcode quiet zone indicator. The default value is true.
  • UPCEANLeadDigitSpace: Defines the space between the first digit (Human Readable Interpretation, HRI) and the start character bar. The default value is 0.
  • UPCEANTrailDigitSpace: Defines the space between the stop character bar and the quiet zone indicator. The default value is 0.
  • UPCEANLeadTrailDigitSizeRatio: Controls the font size of the first and last digits relative to the rest of the digits in the HRI. The default value is 1.0f (equal size).


Customize UPC-A Quiet Zone Indicator

The quiet zone indicator is a small mark at the end of the UPC-A barcode, indicating the end of the quiet zone (empty space around the barcode). You can show or hide this indicator via the Report Item Property panel, following these steps:
  • Select the UPC-A Barcode Component and open the Report Item Property panel.
  • Locate the "ShowQuietZoneIndicator" property.
  • Set it to "false" to hide the quiet zone indicator; leave it as "true" (default) to display it.
  • Save the JRXML template to apply the setting.



Note: Do not reduce the RightMargin below the minimum 9X requirement when hiding the quiet zone indicator. Insufficient quiet zone will cause scanning errors.


Customize UPC-A First/Last Digit Spacing, Position, and Font Size

You can adjust the spacing between the first/last digits and the barcode bars, the vertical position of the first/last digits, and their font size relative to other digits.
  • UPCEANLeadDigitSpace: Adjusts the space between the first digit and the start bar.
  • UPCEANTrailDigitSpace: Adjusts the space between the stop bar and the quiet zone indicator.
  • UPCEANLeadDigitYShift: Adjusts the vertical offset (up/down) of the first digit in the HRI.
  • UPCEANTrailDigitYShift: Adjusts the vertical offset (up/down) of the last digit in the HRI.
  • UPCEANLeadTrailDigitSizeRatio: Adjusts the font size of the first and last digits relative to the rest (e.g., 0.6f means 60% of the default font size).



Note: Avoid setting the UPCEANLeadTrailDigitSizeRatio too small (e.g., below 0.5f), as this may make the first/last digits unreadable. Also, ensure the vertical shift does not move the digits outside the report's Report Band.


Calculate UPC-A Check Digit in JasperReport Reports

The UPC-A check digit is a mandatory component calculated using a modulo 10 (mod 10) algorithm. It ensures data integrity by validating the UPC-A number. The JasperReport Barcode Generator Library automatically calculates and adds the check digit if you provide 11 digits, but understanding the calculation process helps in troubleshooting invalid data.

JasperReport Barcode UPC-A 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.

UPC-A Valid Data Char Set:

  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Property: Add CheckSum Char Type: boolean
Default: false
Add CheckSum Char property is not applied here. iReport Barcode will always add a check character in the last digit (modulo 10).
 
UPC-A Related Property: UPC/EAN Supplement Data Type: expression
Default: ""
  • If you encode the barcode supplement data text directly, the text string should be around by " " ", such as "12345"

  • If you encode the barcode supplement data from dataset, input the expression, such as row["CUSTOMERNUMBER"]
Set the supplement data to encode. Valid values are 2 or 5 digits
Property: UPC/EAN Supplement Bar Height Type: float
Default: 0.8f
This is a multiplicator of the height of the bar module; The default is 0.8 (80% of Y - bar module height).
Property: UPC/EAN Space between main bar and supplement bar Type: float
Default: 15
The separation between the barcode and the supplement. Default is 15 pixel.
 
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

Here we have learned how to print and customize UPC-A barcodes in JasperReport reports using Jaspersoft Studio or iReport Designer. We covered all key aspects, including basic UPC-A generation, customization of quiet zone indicators and digit properties, and check digit calculation.







































Start with free trial package:








































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