 How to Insert Barcode Images into BIRT using Barcode for Java?
BarcodeLib.com is the FIRST Commercial Provider of Java Barcode Library that supports Eclipse BIRT. Prerequisites for Eclips BIRT Barcode Generation 
We are using BIRT 2.2.2 to test our Barcode for Java library. If developer find any problem with previous version of BIRT, please send email to support@barcodelib.com. How to Generate Barcode Images in Your Java BIRT Project? 
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.renderBarcodeToBytes(); 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:
- Put an image on the report.
- Define "Dynamic Image" as Type.
- Click "Select Image Data" Button.
- In the DataBinding Dialog click the "Add..." Button.
- Define "foo" as "Column Binding Name".
- Define "Any" as "Data Type".
- Click Expression button.
- Use the following expression:
reportContext.getAppContext().get("imageBarcode"); - 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.   |