Jump to content
Changes to the Jaspersoft community edition download ×

2004 IR Help

Recommended Posts

By: lgbuffa - lgbuffa2004


2004-03-22 03:28

Hello folks,

I want know how to use a barcode in iReport. Can someone give a step-by-step example?

Thanks a lot!





By: Kees Kuip - keeskuip

RE: Barcode

2004-03-22 10:21


see :






By: lgbuffa - lgbuffa2004

RE: Barcode

2004-03-22 12:39

Thanks for help me, but where do I have to write this code?At Image component?





By: Alex Kotchnev - polrtex

RE: Barcode

2004-03-22 20:04



You could possibly:

1. create a little bean (plain old java class - e.g. BarcodeConvert) in your classpath that receives a string and retuns an image.

2. Then, create a variable (e.g. variable bcdConverter) to hold a reference to that bean (e.g initial value: new BarcodeConvert() ).

3. Finally, wherever you need this barcode inserted, put $V{bcdConverter}.toImage("Your barcode string")


I believe you could accomplish the same if you place the code in the referenced message in a scriptlet, attach the scriptlet to your report, and call the scriptlet method wherever you need the barcode inserted...


I hope this helps.







By: lgbuffa - lgbuffa2004

RE: Barcode

2004-03-25 05:48

Thanks for help, but I solved the problem using a scriptlet.There's the code:


import java.awt.Color;

import java.awt.Image;


import com.lowagie.text.pdf.BarcodeInter25;


import dori.jasper.engine.JRDefaultScriptlet;

import dori.jasper.engine.JRScriptletException;


public class BarCodeScriptlet extends JRDefaultScriptlet {


public void afterReportInit() throws JRScriptletException {


Image image25;

BarcodeInter25 code25 = new BarcodeInter25();



image25 = code25.createAwtImage(Color.black, Color.white);

super.setVariableValue("CODE", image25);





Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...