Barcode
Submitted by Jiujing Gu on Mon, 07/18/2011 - 19:20
Hi Bruno,
I created an image of a barcode using:
Barcode39 code39 = new Barcode39();
code39.setCode(order_ID);
img = code39.createImageWithBarcode(writer.getDirectContent(), null, null);
Everything was fine until there is a group number associated with the order_ID. I did
code39.setCode(order_ID + "-" + groupNumber);
The image looks OK. But the scanner would not read it. What do you think is the problem? The symbol "-"?
Thanks in advance.
Jiujing
- Login to post comments
Content © 2010 1T3XT BVBA

Could be different things
Submitted by Bruno Lowagie on Tue, 07/19/2011 - 11:49.First of all: the "-" symbol is accepted in Barcode 3 of 9.
However: what looks like a "-" symbol could be another character which is not supported (for instance: "—").
Or: maybe your scanner doesn't recognize the "-" character (did you check with other scanners).
Other tricks you could try:
- generate a checksum (with the
setGenerateChecksum()method)- use 3 of 9 extended (using
setExtended(true))- ...
I've tried this myself:
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(
document, new FileOutputStream("results/code39.pdf"));
document.open();
Barcode39 code39 = new Barcode39();
code39.setCode("*1234-5678*");
Image code = code39.createImageWithBarcode(
writer.getDirectContent(), null, null);
document.add(code);
document.close();
Unfortunately, my barcode reader doesn't read Code 3 of 9...
I finally found the problem.
Submitted by Jiujing Gu on Tue, 07/19/2011 - 21:34.I finally found the problem. The problem was not caused by the dash. It was caused by
the border of the table cell. It worked as soon as I moved the barcode away from the border.
Cheers,
Thank you for the feedback
Submitted by Bruno Lowagie on Wed, 07/20/2011 - 06:48.That was a problem I couldn't have solved remotely ;-)
I must remember this answer, because I think you're not the only one who has experienced this problem.