Eclipse BIRT Barcode Generation



Java Barcode is a BIRT barcode generator which generates high quality 1D (linear) and 2D (matrix) barcodes in Eclipse BIRT projects.



Libraries Needed





How to generate barcodes in BIRT using Java Barcode?



Here is the sample source code.

// get engine from Birt Bootstrapping...
// ...
reportDesign = engine.openReportDesign("C://foo.rptdesign");
//create task to run and render report
IRunAndRenderTask task = engine.createRunAndRenderTask(reportDesign);

//set options
PDFRenderOption options = new PDFRenderOption();
options.setOutputFileName("foo.pdf");
options.setOutputFormat("pdf");

task.setRenderOption(options);

// barcode is a com.barcodelib.barcode.Linear object
byte[] bytes = barcode.drawBarcodeToBytes();
task.getAppContext().put("imageBarcode", bytes);

//run and render report
task.run();
task.close();

So this was a simple Main Class using a Birt Engine to dynamicly put a byte[] to a report Context and run the report. Now do the following in the Report Designer:

  1. Put an image on the report

  2. Define "Dynamic Image" as Type

  3. click "Select Image Data" Button

  4. In the DataBinding Dialog click the "Add..." Button

  5. define "foo" as "Column Binding Name"

  6. define "Any" as "Data Type"

  7. click Expression button

  8. use the following expression:

  9. reportContext.getAppContext().get("imageBarcode");

  10. check the checkbox in front of the "foo" entry in dialog



Thats all. If everything works fine, the dialogs should look like below. When you now run your report the barcode should be visible where you placed the image container.





Java Reporting Barcode Generation Guide

Jasper Reports Barcode Generation     |     iReport Barcode Generation     |     Eclipse BIRT Barcode Generation



Barcode Generation Guide for .NET / Java Developers

.NET Barcode Generation     |     C# Barcode Generation     |     ASP.NET Barcode Generation     |     VB.NET Barcode Generation

Java Barcode Generation