Reputation:
I have created an application which generates the barcode.
Here is the code how I created the barcode:
Code39 code39 = new Code39();
String outputStr = code39.encode("B00009", 1);
//String humanTextStr=code39.getHumanText();
lblBarcode.setText(outputStr);
lblBarcode.setFont(new java.awt.Font("CCode39_S3_Trial",java.awt.Font.PLAIN,14));
Using this java library ConnectCodeBarcodeFontLibrary.jar.
For scanning the barcode I used QRbot app which gives me this information - extra letter at the end B00009K
instead of this B00009
.
Here is the screenshot of generated barcode:
What is the problem in this scenario?
Upvotes: 3
Views: 970
Reputation:
By following the @kunif's answer of ASSUME_CODE_39_CHECK_DIGIT
code which saying that it uses a check digit. So, I have analyzed my code and I found that code39.encode("B00009", 1);
passing the second parameter 1 which is the reason why it generates the extra letter K
at the end of barcode number.
So, I changed the 1 which 0 and now its scanning the barcode correctly.
String outputStr = code39.encode("B00009", 0);
Upvotes: 0
Reputation: 4350
Code 39 has the option of using a check digit and is called Code 39 mod 43.
Code 39 mod 43 - Wikipedia
For example, ZXing's Code39Reader has an option called ASSUME_CODE_39_CHECK_DIGIT (a mode in which a check digit is generated from barcode data even if there is no check digit and is notified?).
Class Code39Reader
public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints) throws NotFoundException, ChecksumException, FormatException
public static final DecodeHintType ASSUME_CODE_39_CHECK_DIGIT
Assume Code 39 codes employ a check digit. Doesn't matter what it maps to; use Boolean.TRUE.
Whether your program added a check digit when it generated the barcode (but did not print it in human-readable characters), or whether the program that read the barcode supplemented the check digit and generated/notified it. There can be one of two possibilities.
By the way, the last K
was notified when the barcode presented was read with the Honeywell Xenon 1900 in the default No Check Character mode, so a check digit may have been added when generating the barcode in your program. Will be high.
Upvotes: 6