Not Able to read bar code

To Test Barcode Case.pdf (755.8 KB)
Hi Team,

we not able to read barcode from attached file. we used
Aspose Barcode Version : 22.5
Aspose Pdf Version : 21.3
Aspose Word Version : 21.9

Below code
MemoryStream stream1 = new MemoryStream(documentA.doc);
Aspose.Pdf.Document doc1 = new Aspose.Pdf.Document(stream1);

        Int32 BarcodeCount1 = 0;            
        List<String> barcode_list1 = new List<string>();           

            Aspose.Pdf.Facades.PdfExtractor pdfExtractor1 = new Aspose.Pdf.Facades.PdfExtractor();


            pdfExtractor1.BindPdf(stream1);
            pdfExtractor1.ExtractImage();



            while (pdfExtractor1.HasNextImage())
            {
                MemoryStream imageStream1 = new MemoryStream();
                pdfExtractor1.GetNextImage(imageStream1);



                using (BarCodeReader reader = new BarCodeReader(imageStream1,                        DecodeType.Code39Standard))
                {
                    foreach (BarCodeResult result in reader.ReadBarCodes())
                    {
                        BarcodeCount1++;
                        barcode_list1.Add(result.CodeText);
                    }
                }
            }              

Issue : We are unable to read barcode in attached document using above code.

        Barcode was generated, using aspose as well    

Code to add Barcode :

                       Code39 code = new Code39(Guid.NewGuid().ToString().ToUpper());

                        byteArrayBarcode = code.Paint();

                        System.IO.MemoryStream ms = new System.IO.MemoryStream(byteArrayBarcode);

                        ImageStamp img = new ImageStamp(ms);                           
                        //img.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/" + ".png");
                        img.HorizontalAlignment = HorizontalAlignment.Left;
                        img.VerticalAlignment = VerticalAlignment.Bottom;
                        img.LeftMargin = 70;
                        img.BottomMargin = 8;
                        img.Background = true;                            
                        img.XIndent = 200;
                        img.YIndent = 150;
                        img.Height = 30;
                        img.Width = 200;
                        errorCounter = 20;

                        Random random = new Random();
                        img.setStampId(random.Next(int.MaxValue));

                        Aspose.Pdf.Document document2 = new Aspose.Pdf.Document(filePath);
                        for (int page = 1; page <= document2.Pages.Count; page++)
                        {
                            PageCollection pagecollection = document2.Pages;

                            pagecollection[page].AddStamp(img);                                
                        }
                        // Save updated PDF file
                        document2.Save(filePath);

@Vipin_Paliwal

Would you please try using the latest version(s) of the API and if issue still persists, please share the Exception message and complete error stack trace with us so that we can further proceed to assist you accordingly. Instead of using streams, also please try to save the extracted barcode to file path and read barcode from it.

To Test Barcode Case.pdf (755.8 KB)

We tried reading barcodes with Aspose barcode version 23.6 but still we are not able to read barcode in below document. Attached file we tried.

@Vipin_Paliwal

We tested while extracting images and saving them to a path using Aspose.PDF and it looks like that the API is extracting and saving images correctly. However, Aspose.BarCode was unable to read the barcodes. Therefore, we have moved this inquiry to Aspose.BarCode Category where this case will be investigated from other perspective and feedback will be shared with you accordingly.

Aspose.Pdf.Document doc1 = new Aspose.Pdf.Document(dataDir + "To Test Barcode Case.pdf");

Int32 BarcodeCount1 = 0;
List<String> barcode_list1 = new List<string>();

Aspose.Pdf.Facades.PdfExtractor pdfExtractor1 = new Aspose.Pdf.Facades.PdfExtractor();
pdfExtractor1.BindPdf(doc1);
pdfExtractor1.ExtractImage();

while (pdfExtractor1.HasNextImage())
{
 string imageStream1 = dataDir + DateTime.Now.Millisecond + ".png";
 pdfExtractor1.GetNextImage(imageStream1);// (imageStream1);



 using (BarCodeReader reader = new BarCodeReader(imageStream1, DecodeType.Code39Standard))
 {
  foreach (BarCodeResult result in reader.ReadBarCodes())
  {
   BarcodeCount1++;
   barcode_list1.Add(result.CodeText);
  }
 }
}

@Vipin_Paliwal,

After an initial testing, we reproduced the issue as you mentioned by using your sample PDF document. We found Aspose.BarCode could not read bar codes from the document. We need to investigate your issue in details.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): BARCODENET-38662

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@Vipin_Paliwal,

We evaluated your issue further. We found barcodes have too low quality and cannot be recognized by other engines as well. Aspose.BarCode may not recognize or detect them. Currently the issue is postponed with no ETA (available) at the moment.

We apologize for any inconvenience caused!

@Vipin_Paliwal,

After thorough evaluation, we conclude that the barcode has extremely low modulation (MOD) according to section 5.4.7 of the ISO/IEC 15416 Barcode Print Quality Test Specification. Consequently, this barcode has a quality grade of 0 and cannot be recognized. Therefore, this issue is not considered as a bug and will be closed.