Package net.sf.jasperreports.components.barcode4j

Contains classes for the built-in Barcode4J component.

See: Description

Package net.sf.jasperreports.components.barcode4j Description

Contains classes for the built-in Barcode4J component.

The Barcode4J Component

This component relies on the Barcode4J library (
Unlike the Barbecue barcode component, there is only one component per Barcode4J barcode type. All the barcode's components derive from a base type which defines its common attributes.

All barcodes in this library include a code expression, which provides the textual data to be encoded in the barcode, and an optional expression that provides a pattern to be applied on the message displayed in the barcode. Delayed evaluation of the barcode can be configured using the two evaluation attributes and works in the same way as for Barbecue barcodes.

Several optional barcode rendering attributes can be set: Concrete barcode types extend the base type by adding further attributes supported by the specific symboloy: The object model for the barcode components uses BarcodeComponent as base class and concrete classes for each barcode type.

When a report that contains barcodes is filled, the data and attributes of the barcode are collected into an object and passed to an image producer whose responsibility is to create a renderer for the barcode. The image producer implements the BarcodeImageProducer interface. As for Barbecue barcode elements, the resulting images have the size of the design barcode element and use RetainShape as scale type.

Determining which image producer to use for a barcode component element relies on custom properties defined at the element, report and global levels. The net.sf.jasperreports.components.barcode4j.image.producer property can have a value of the name of the class that implements the image producer interface or an alias that has been set for such a class, using a property of the form net.sf.jasperreports.components.barcode4j.image.producer.<alias>. JasperReports has two barcode image producer implementations: one which renders the barcode in SVG format and one which renders the barcode as a rasterized image. The first implementation is registered under the svg alias and is used by default; the second one has image as alias and can be used by changing the net.sf.jasperreports.components.barcode4j.image.producer.<alias> property at any level.

The SVG barcode image producer uses the Barcode4J API to export the barcode to SVG, then it creates an SVG renderer based on the Batik SVG library. Hence, this option introduces a dependency on Batik for viewing or exporting a report that includes barcodes.

The rasterized image producer draws the barcode on a PNG image which can be then displayed in the generated report. This producer uses further properties, set at the same levels as the image producer property, to allow the customization of the generated image.

© 2001 - 2016 TIBCO Software Inc.