BarCode Image Generator in Java

JavaGeneratorBarcode

Java Problem Overview


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?

Java Solutions


Solution 1 - Java

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.

Solution 2 - Java

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

Barbecue

Solution 3 - Java

There is a free library called barcode4j

Solution 4 - Java

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/]

Solution 5 - Java

I use barbeque , it's great, and supports a very wide range of different barcode formats.
See if you like its API .

Sample API:

public static Barcode createCode128(java.lang.String data)
throws BarcodeException

> Creates a Code 128 barcode that > dynamically switches between character > sets to give the smallest possible > encoding. This will encode all > numeric characters, upper and lower > case alpha characters and control > characters from the standard ASCII > character set. The size of the barcode > created will be the smallest possible > for the given data, and use of this > "optimal" encoding will generally > give smaller barcodes than any of the > other 3 "vanilla" encodings.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionom.View Question on Stackoverflow
Solution 1 - JavaChris DailView Answer on Stackoverflow
Solution 2 - JavaArto UusikangasView Answer on Stackoverflow
Solution 3 - JavaTrue SoftView Answer on Stackoverflow
Solution 4 - JavaVineet ManoharView Answer on Stackoverflow
Solution 5 - JavabguizView Answer on Stackoverflow