javabarcodebarcode-scannerscanning

Getting extra letters after scanning the barcode using Java


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:

enter image description here

What is the problem in this scenario?


Solution

  • 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);