JasperReports Ultimate Guide - Sample Reference - Schema Reference - Configuration Reference - API (Javadoc)
|
|
|
|
JasperReports - Barbecue Sample (version 4.6.0) | ![]() |
|
|
|
Main Features in This Sample | |
| Barcodes (Barbecue Custom Component) |
|
|
Secondary Features | |
Barcodes |
![]() | ![]() | ![]() | ![]() |
|
|
top | |||||
|
|||||
![]() | Barcodes (Barbecue Custom Component) | Documented by Sanda Zaharia | |||
|
|||||
| Description / Goal |
| Shows how to render barcodes in a report, using the barcode component based on the Barbecue library. | ||
| Since |
| 3.5.2 | ||
|
|||||
|
The Barbecue Library
As shown in the Barcodes section, the use of barcodes became universal. Depending on particular needs, there are several barcode specifications, called symbologies. This sample illustrates how to use the built-in component based on the open source Barbecue library. The Barbecue library supports the following barcode formats:
According to the barbecue element in the components.xsd schema, to completely determine a barcode, the following pieces are needed: Elements:
The sample shows how can be used the barbecue component to compute various barcodes:
<parameter name="Code" class="java.lang.String"> <defaultValueExpression><![CDATA["01234567890"]] ></defaultValueExpression> </parameter> ... <componentElement> <reportElement x="0" y="100" width="400" height="50"/> <c:barbecue xmlns:c="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" type="Code128" drawText="true" checksumRequired="false"> <c:codeExpression><![CDATA["JasperReports"]] ></c:codeExpression> </c:barbecue> </componentElement> <componentElement> <reportElement x="0" y="160" width="400" height="50"/> <c:barbecue xmlns:c="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" type="Codabar" drawText="true" checksumRequired="false"> <c:codeExpression><![CDATA[$P{Code}]] ></c:codeExpression> </c:barbecue> </componentElement> <componentElement> <reportElement x="0" y="220" width="400" height="50"/> <c:barbecue xmlns:c="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" type="Int2of5" drawText="true" checksumRequired="true" barWidth="3" barHeight="20"> <c:codeExpression><![CDATA[$P{Code}]] ></c:codeExpression> </c:barbecue> </componentElement> <componentElement> <reportElement x="0" y="280" width="400" height="50"/> <c:barbecue xmlns:c="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" type="Std2of5" drawText="false" checksumRequired="false"> <c:codeExpression><![CDATA[$P{Code}]] ></c:codeExpression> </c:barbecue> </componentElement> ...Running the Sample Running the sample requires the Apache Ant library. Make sure that ant is already installed on your system (version 1.5 or later).
In a command prompt/terminal window set the current folder to demo/samples/barbecue within the JasperReports source project and run the > ant test view command.
It will generate all supported document types containing the sample report in the demo/samples/barbecue/build/reports directory.
Then the report will open in the JasperReports internal viewer. |
||||
|
|
© 2001- Jaspersoft Corporation www.jaspersoft.com |