Free Support Forum -

Some parts of code text not recognized

I am writing an application using JAVA with PDF417 code type to do the following:
1. User input text and web application display the barcode on screen.
2a. User print the barcode to a PDF file directly.
2b. User print the barcode using a printer, then use a scanner to scan the prinout as a PDF file.
3. The application read the barcode.

The barcode text can be read successfully if using step 2a,
but some parts of text cannot be read if using step 2b.

I wonder if i have to do some setting in the scanner?
or if i can change any setting in my java code?

below is the code i used to create the barcode.

int symbology = Symbology.Pdf417;
BarCodeBuilder b = new BarCodeBuilder();
byte[] encoded = Base64.encodeBase64(inputStr.getBytes());
BufferedImage bImg = b.getBarCodeImage();
below is the code i used to read the barcode.

PdfImageObject image = renderInfo.getImage();
BufferedImage awtimage = renderInfo.getImage().getBufferedImage();
BarCodeReadType barCodeReadType = BarCodeReadType.getPdf417();
BarCodeReader bcr = new BarCodeReader(awtimage, barCodeReadType);
if ({
byte [] bArr = bcr.getCodeBytes();
byte[] decoded = Base64.decodeBase64(bArr);
System.out.println("bcr : " + bcr.getCodeText());
System.out.println("Base 64 Decoded String : " + new String(decoded));
setBarcodeText(new String(decoded));
} else {
//System.out.println("Not recognized!");
}else {
//System.out.println("Cannot read image!");
output as below:
bcr : MS9XU0QvMDMoRSk% 3 oRSh:ztBQTBQOTlYMDE4OTTlYMDE4OTs7O0ZTOzs7MS9XU0QvMDMoRSqQWgwnOOwgk7OztOOzsk7OztOjw7Mzs7O2FiYzs7Ow==XX
Base 64 Decoded String : 1/WSD/03(E)7𩄍﹡羾LNV NM9X0189;;;FS;;;1/WSD/03(E*𣉢 '8𩄍敫陷蒬淇恄茛籀3陶𩄍&3陶𩄍灉

Please help.
Attached is the PDF i get from the scanner.

Hi Cammi,

Please accept our apologies for the delay. We are working over your query and will get back to you as soon as possible.

Hi Cammi,

Thank you for your interest in our products.

I have tested your provided sample against the latest build of Aspose.BarCode for Java v5.0.0. I regretfully inform you that the latest version was unable to recognize barcode from your sample. This problem has been logged in our bug tracking system under ticket Id BARCODJAVA-33265. We will soon investigate the cause of recognition failure and share our results here. Also, you will be notified once the fix for your problem is available for public use. It would be great if you can share exact code text string before/after Base64 encoding.

Please accept our apologies for your inconvenience.

Hi Imran,

for this line, I used this open source library, "org.apache.commons.codec.binary.Base64"

byte[] encoded = Base64.encodeBase64(inputStr.getBytes());

I added two lines in my code.

System.out.println("input str: " + inputStr);
System.out.println("encoded str: " + encoded.toString());

And output are below.
input str: 1/WSD/03(E);;;AA0P99X0189;;;FS;;;1/WSD/03(E);;;N;;;3;;;abc;;;
encoded str: [B@157507d9v

Hi Imran,

I get the code text by using your API.


the encoded codetext is

Thanks for your help.

Hi Cammi,

Thanks for the additional information. I have passed this information to our development team. We will inform you as soon as this issue is resolved. We apologize for your inconvenience.

The issues you have found earlier (filed as BARCODJAVA-33265) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.