9

I am developing a simple application for printing stickers and I need to print barcodes. For some reasons I need to generate barcodes as text not as images. It is all good enough with barcode creation and printing but scanner do not recognize these barcodes.

I am using JLabel component and system barcode font for it (IDAutomationHC39M, C39HrP24DhTt) for barcode creation. Scanner tried to recognize it (it automatically switched to constant laser mode) but there is no result.

Barcode text example 999-999999-9/9

So, maybe I missed something or did something wrong? Full explanation or link will be appreciated!

UPD code example

barcodeLabel = new JLabel("*"+hwb.getNumber()+"-1/1*");
Font f = new Font("IDAutomationHC39M",java.awt.Font.PLAIN,8);
barcodeLabel.setFont(f); 

Please ignore hardcoded "1/1" - it's for test only.

UPD printed barcode example enter image description here

SOME UPDATE

It looks strange but seems that problem is in the scanner - I have tried with a laser scanner, the scanner application on my Android phone and got no result. I called it strange because the scanner successfully worked with code39 barcodes before. Now I have tried to scan with zxing-based scanner in my own Android app and it recognized successfully. I will make some experiments with different scanners during next days.

FINALLY

I have tried to scan these barcodes on two other scanners (Metrologic and Symbol) and they show perfect results - all barcodes recognized successfully. I think all problems was in my cheap scanner - it works great with barcodes printed on laser printer but if print quality is not ideal - it useless. I'm very sorry that I have started topic because of this stupid device and my own inattention. Anyway thanks for all commentators, topic may be closed.

12
  • A good library you can use is iText, it could generate a PDF or picture so you can show it after! Jan 7, 2013 at 15:02
  • thanks for your advice but I can't work with barcode as image. I've tried Barcode4J already but sticker printer shows very bad quality for printing images - and there is no way to improve it.
    – Viacheslav
    Jan 7, 2013 at 15:06
  • Without any example code, it´ll be hard to see what you might do wrong. Also, it´s not just the print layout, but the barcode content that might count. There are many different barcode encoding standards, and some of them require you to add a suffix containing a checksum, or a check digit, that validate the net result´s correctness. Most scanners will ignore all scans that do not contain the correct checksum/check digit even though the barcode is, pixel-by-pixel, "correct". Jan 7, 2013 at 15:13
  • 1
    That would be "reinventing of wheal". You can use some library like Barbecue: barbecue.sourceforge.net . Not sure, but I think that Jasper iReport features barcode generator: community.jaspersoft.com/project/jasperreports-library Jan 7, 2013 at 15:19
  • @brano88 - thanks, but as I said images is printing with very low quality on my sticker printer.
    – Viacheslav
    Jan 7, 2013 at 15:22

1 Answer 1

0

I have tried to scan these barcodes on two other scanners (Metrologic and Symbol) and they show perfect results - all barcodes recognized successfully. I believe all problems was in my cheap scanner - it works great with barcodes printed on laser printer but if print quality is not ideal - it useless. So there was no programm mistakes only hardware limitations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.