KeepAutomation.com  > Products  >  Java Barcode  > Java Barcode Generation Guide  > Jasper Barcode Generator



KeepAutomation Java Barcode is a Java barcode generator, which supports most common linear and 2D barcode types, and helps Java developers quickly and easily add barcode generation functionality to Jasper Reports.

      [Java Barcode Info]      [Download Java barcode free evaluation package]


Java Libraries

  • KeepAutomation Java Barcode jar [download]

  • Jasper Reports 2.0 and later version
View how to generate barcodes in iReport

Generate barcodes in Jasper Reports

Create a new Jasper report template

  • 1. Import java barcode class
    <import value="com.keepautomation.barcode.jasper.BarcodeFactory"/> 
    
  • 2. Insert a barcode image into the report template
    <image scaleImage="Clip" hAlign="Center"> 
        <reportElement x="50" y="50" width="250" height="180"/> 
        <graphicElement/> 
        <imageExpression class="net.sf.jasperreports.engine.JRRenderable">
    <![CDATA[new com.keepautomation.barcode.jasper.BarcodeRenderer (BarcodeFactory.createLinear(3, "123456789"))]]></imageExpression> </image>
  • 3. If barcode value is getting from database. Define the data field and replace barcode data in the above code with $F{DataFieldName}.
    For the above code, replace "123456789" with $F{DataFieldName}