See: Description
| Interface | Description |
|---|---|
| BarcodeImageProducer | |
| BarcodeVisitor |
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:orientation - specifies how the barcode and any accompanying text are to be
oriented when rendered. There are 4 possible values:
moduleWidth - specifies the width (in pixels) of the thinnest bar/module.textPosition - Sets the placement of the human-readable barcode message. It has
three possible values: none - meaning no human-readable message, and
bottom and top.
quietZone - Specifies the width of the quiet zone (in pixels).verticalQuietZone - Specifies the height of the vertical quiet zone (in pixels).wideFactor attribute that specifies the factor between the
width of wide bars and the width of narrow bars.checksumMode
attribute which indicates how the check digit is to be handled. The attribute accepts
four values:
add - adds the checksum to the data;check - indicates that the data should already contain a checksum;ignore - doesn't expect or add a checksum to the data;auto - attempts to detect whether a checksum is already present in the
data or one should be added.shape attribute.checksumMode attribute, a displayChecksum
attribute that controls whether the human-readable message shows the checksum
character, a displayStartStop attribute which decides whether start/stop
characters are to be displayed in the human-readable message,
extendedCharSetEnabled to indicate that the barcode can display characters
from the entire 7-bit ASCII set, intercharGapWidth to control the width between
the characters and a wideFactor attribute.checksumMode, displayChecksum and
wideFactor attributes with the same meanings as in Code39 barcodes.checksumMode
attribute, an intercharGapWidth attribute, an ascenderHeight attribute which
sets the length of the bar ascender/descender, and a trackHeight attribute which
provides the height of the barcode track.checksumMode, displayChecksum and
intercharGapWidth attributes, plus shortBarHeight for setting the height of
the short bar, and baselinePosition which can be top or bottom
to indicate how bars should align.minColumns, maxColumns, minRows, maxRows and
widthToHeightRatio attributes. The error correction level can be set using the
errorCorrectionLevel attribute.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.
Copyright © 2014. All rights reserved.