HOW-TO Create bar code columns

This new feature makes the existing JasperReports and Barbecue integration available in DynamicJasper.

In the following example, we are adding a bar code column (the last one)

FastReportBuilder drb = new FastReportBuilder();
drb.addColumn("State", "state", String.class.getName(),20)
        .addColumn("Branch", "branch", String.class.getName(),30)
        .addColumn("Quantity", "quantity", Long.class.getName(),60,true)
        .addColumn("Amount", "amount", Float.class.getName(),70,true)
        .addBarcodeColumn("Bar-Code", "amount", Long.class.getName(), BarcodeTypes.USD3, true,
false,null, 100, true, ImageScaleMode.FILL, null)
        .setTitle("November 2006 sales report")
        .setSubtitle("This report was generated at " + new Date())

DynamicReport dr =;

In this code, the key call is

.addBarcodeColumn(      <column title>, <property>, <class>,
                                        <barcode type>, <show text>, <checksum>,
                                        <application identifier>, <width>, <fixed column>,
                                        <fill mode>, <style> )


  • column title is the title of the column.
  • property is the property of the current element to use as the input for the bar code
  • class is the class type of property. Regardles off the bar code specific valid input (character), a String is needed for the bar code.
  • barcode type is a constant from
  • show text is boolean that when true, the text is displayed bellow the bar code (only available in some bar code types)
  • checksum (boolean) if true and the bar code type allows it, the checksum is added to the bar code.
  • application identifier: (Optional) only for UCCEAN128, this must be a property from the data source to a String object. The field is registered automatically.
  • width of the column
  • fixed column (boolean) if true, the width is mandatory and no resize will be done.
  • fill mode specifies how to deal with the size of the bar code:
    • ImageScaleMode.NO_RESIZE: no resize of the bar code
    • ImageScaleMode.FILL: stretches the bar code to fill the rectangle (the with of the column and the height of the detail band)
    • ImageScaleMode.FILL_PROPORTIONALLY: stretches the bar code proportionally as much as it can to fill the area given to the column.
  • style: (Optional) to give the column horizontal alignment, border, etc…

This code generate a report like this:

no images were found

Refer to BarcodeColumnReportTest for a working example.

    Fork me on GitHub