views:

453

answers:

5

How can I create a barcode image in Java? I need something that will allow me to enter a number and produce the corresponding barcode image. Is there a free library available for this type of task?

+5  A: 

iText is a great Java PDF library. They also have an API for creating barcodes. You don't need to be creating a PDF to use it.

This page has the details on creating barcodes. Here is an example from that site:

BarcodeEAN codeEAN = new BarcodeEAN();
codeEAN.setCodeType(codeEAN.EAN13);
codeEAN.setCode("9780201615883");
Image imageEAN = codeEAN.createImageWithBarcode(cb, null, null);

The biggest thing you will need to determine is what type of barcode you need. There are many different barcode formats and iText does support a lot of them. You will need to know what format you need before you can determine if this API will work for you.

Chris Dail
Thanks Chris,Let me try this.
om
+2  A: 

There is a free library called barcode4j

True Soft
thanks True Soft
om
+6  A: 

There is also this free API that you can use to make free barcodes in java.

Barbecue

Arto Uusikangas
Thanks Arto Uusikangas
om
No problems mate.. that's why we are here...
Arto Uusikangas
+2  A: 
bguiz
Thanks bguiz for help
om
+1  A: 

ZXing is a free open source Java library to read and generate barcode images. You need to get the source code and build the jars yourself. Here's a simple tutorial that I wrote for building with ZXing jars and writing your first program with ZXing.

[http://www.vineetmanohar.com/2010/09/java-barcode-api/]

Vineet Manohar