Free Support Forum - aspose.com

How to read multiple barcode types?

I am using 2.7.0 of Aspose.Barcode Java.

If I use the reader code below it reads nothing:
BarCodeReadType brt = BarCodeReadType.Empty;
brt.append(BarCodeReadType.Code39Standard);
brt.append(BarCodeReadType.Code128)

If I use the reader code below it reads Code 3 of 9 barcodes:
BarCodeReadType brt = BarCodeReadType.Code39Standard;
brt.append(BarCodeReadType.Code128)

If I use the reader code below it reads Code 128 barcodes:
BarCodeReadType brt = BarCodeReadType.Code128;
brt.append(BarCodeReadType.Code39Standard)

If I use:
BarCodeReadType brt = BarCodeReadType.AllSupportedTypes;
I get the following exception:
SEVERE: Error reading barcode! (My Error Message)
java.lang.NullPointerException
at com.aspose.barcoderecognition.bs.a(SourceFile:14)
at com.aspose.barcoderecognition.bt.a(SourceFile:385)
at com.aspose.barcoderecognition.bt.a(SourceFile:252)
at com.aspose.barcoderecognition.bt.a(SourceFile:209)
at com.aspose.barcoderecognition.bt.b(SourceFile:45)
at com.aspose.barcoderecognition.T.b(SourceFile:33)
at com.aspose.barcoderecognition.T.b(SourceFile:33)
at com.aspose.barcoderecognition.BarCodeReader.dV(SourceFile:183)
at com.aspose.barcoderecognition.BarCodeReader.read(SourceFile:156)

How can I just read Code128 and Code39Standard(Or any barcodes types of my choice)?

Hi,


Thank you for your inquiry.

Please check the following technical articles on the subject,
http://www.aspose.com/documentation/java-components/aspose.barcode-for-java/recognizing-specific-barcode-symbology.html
http://www.aspose.com/documentation/java-components/aspose.barcode-for-java/recognizing-multiple-symbologies-in-single-image.html

If you know the symbology of the barcode that you are trying to read then you can specify the BarCodeReadType in BarCodeReader constructor. If there are several symbologies in one image than you can append BarCodeReadType as below,

try
{
Image img = Toolkit.getDefaultToolkit().getImage(“c:\temp\test.jpg”);
BarCodeReader reader = new BarCodeReader(img, (BarCodeReadType.Code128).append(BarCodeReadType.Code39Standard));
if(reader.read())
{
BarCodeReadType brt = reader.getReadType();
System.out.println("BarCodeReadType: " + brt.toString());
System.out.println("CodeText: " + reader.getCodeText().toString());
}
}
catch(Exception ex)
{
System.out.println("Error: " + ex.getMessage());
}

For your said exception, can you please post us your sample image/Pdf to reproduce it on our end.
Thanks, didn't realize append returns a new BarCodeReadType object without altering the original.
BarCodeReadType brt = BarCodeReadType.Code39Standard.append(BarCodeReadType.Code128);


Hi,


Thank you for sharing your sample file.

The process of reading the BarCode from a Tiff file is completely different from reading a BarCode from Png or Jpeg. Please have look on the below article,
http://www.aspose.com/documentation/java-components/aspose.barcode-for-java/how-to-read-barcode-from-multipage-tiff-images.html

You may see that we have used JAI (Java Advanced Imaging) library to read Tiff files. Please give it a try and feel free to write back.

No issue with reading the tif image, I also use the JAI library. I have it reading both 128 and 39 barcodes on the same image and get no exceptions thrown for any Images I have tried so far. However if I use AllSupportedFormats it throws an exception for that one.

Hi,


Thank you for further detail.

I am able to reproduce your said exception with your provided Tiff file. So I have logged this issue in our bug tracking system under ticket ID BARCODJAVA-31563. We will look into this matter and provide you a fix as soon as possible.

Sorry for any inconvenience caused.

Thanks for the information about multiple barcodes types… :slight_smile: If you have time kindly visit my site its about car window tinting. Thanks :slight_smile:

Hi Jayford,


Good news for you is the fix of BARCODJAVA-31563 has been included in our new release of Aspose.BarCode for Java 5.3.0 which is now available for public use. Please visit the download page here:
http://www.aspose.com/community/files/72/java-components/aspose.barcode-for-java/default.aspx

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


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