Free Support Forum -

EAN 13 getting recognized as UPCA and extracting wrong data

Attached is a file which has EAN 13 on Page 1. My Reader sample code is as follows
long barcodetype = BarCodeReadType.getTypeFromName(“GS1Code128”)
| BarCodeReadType.getTypeFromName(“Interleaved2of5”)
| BarCodeReadType.getTypeFromName(“ITF14”)
| BarCodeReadType.getTypeFromName(“Code39Extended”)
| BarCodeReadType.getTypeFromName(“Code39Standard”)
| BarCodeReadType.getTypeFromName(“IATA2of5”)69.pdf (9.8 KB)

                     | BarCodeReadType.getTypeFromName("Code93Extended")
                     | BarCodeReadType.getTypeFromName("Code93Standard")
                     | BarCodeReadType.getTypeFromName("UPCA")
                     | BarCodeReadType.getTypeFromName("UPCE") 
                     | BarCodeReadType.getTypeFromName("Code128")
                     | BarCodeReadType.getTypeFromName("Standard2of5")
                     | BarCodeReadType.getTypeFromName("Matrix2of5");
             System.out.println("Barcode Long value : " + barcodetype);
    BarCodeReader reader = new BarCodeReader(imageStream, barcodetype);

    while ( {
     // Get the region information
        String value = reader.getCodeText();
        // Point[] points = reader.getRegion().getPoints();
        // String checksum = reader.getCheckSum();
        String barcodeType = reader.getCodeTypeName();
        // Rect rect = new Rect(points[0].getX(), points[0].getY(),
        // points[2].getX() - points[0].getX(), points[2].getY() -
        // points[0].getY(), false);
        System.out.println("Barcode Type : " + reader.getCodeTypeName());
        System.out.println("Barcode Value : " + reader.getCodeText());
        BarcodeValue barcodeValue = new BarcodeValue(value, barcodeType);

Results are
Barcode Long value : 3629308
Barcode Type : UPCA
Barcode Value : 72841450515
Barcode Type : UPCA
Barcode Value : 87824246950
Barcode Type : UPCA
Barcode Value : 01779011553
Barcode Type : UPCA
Barcode Value : 08070730001
Barcode Type : UPCA
Barcode Value : 15711000138


We are looking into this issue. We will update you soon about our findings.


We are trying to process the sample PDF file shared by you. It seems that there is some issue in the PDF document as Adobe acrobat is not extracting the barcode images. Please check at your end and forward us the sample file that you are using at your end.

What issue are you having, I used the same document on my test and I’m able to extract the barcode but the values are incorrect. I opened it in Acrobat and I can find 978 0-444-50515 which is one of the barcode values.
Please explain the issue.


Thank you for your patience. We have further investigated the PDF file shared by you. The barcode images are added in small chunks. By opening it in Adobe Acrobat, you will notice that barcode images cannot be selected as a whole image. When you select edit image option from tools, then you can select the smaller chunks of images. We have attached the code snippet that we are using to read the barcodes for your reference.

It is requested to please forward us a sample project demonstrating the issue. We will evaluate it and update you about our findings.


// bind the pdf document
Aspose.Pdf.Facades.PdfExtractor pdfExtractor = new Aspose.Pdf.Facades.PdfExtractor();

// extract the images
Console.WriteLine("Extracting images.....");
// save images to stream in a loop
while (pdfExtractor.HasNextImage())
Console.WriteLine("Getting next image....");
// save image to stream
System.IO.MemoryStream imageStream = new System.IO.MemoryStream();
imageStream.Position = 0;

Console.WriteLine("Recognizing barcode....");
Aspose.BarCode.BarCodeRecognition.BarCodeReader barcodeReader =  new Aspose.BarCode.BarCodeRecognition.BarCodeReader(imageStream);

while (barcodeReader.Read())
                    Console.WriteLine("Codetext found: " + barcodeReader.GetCodeText() + ", Symbology: " + barcodeReader.GetCodeType().ToString());
                // close the reader