Title: Barcode Image sizes

I'm trying to create Barcode images using the Barcode.createAwtImage() method on the Barcode class. I try to test the resulting image against the same code created using the Barcodes.java example document. I want to be able to create the same barcode using createAwtImage() as would be produced by createImageWithBarcode().

The problem is that the barcode that is created is using createAwtImage() is a bit larger than the code created when it is run through the iText image creation. After some careful examination, it looks to be about 80% too big.

I did some digging in the iText source code and found that the createAwtImage() does not apply the "x" factor (minimum bar width) of the barcodes. Is it supposed to work like this? I would think that this would produce a barcode that could not be properly read. Is this a known issue and how can I get around this.

Here is the code for what I am trying to use:
Barcode barcode = new Barcode();
barcode.setBarHeight(Integer.parseInt(barHeight));
barcode.setCode(code);
Image image = barcode.createAwtImage(Color.black, Color.white);

Thanks

Chris Dail
Whitehill Technologies, Inc.

Reply via email to