QrCode and Barcode in same image in pdf

Hi,
I’m sure there is nothing wrong with my .Net code. When I try it recognises the bar but not the Qr. If I erase the barcode it can read the Qr on its own. Please tell me if you are able to read them both.
BarAndQR.pdf (175.7 KB)
Thanks

@JsonB,

Could you please share your sample code snippet or preferably a standalone console app (please zip the project (excluding Aspose.BarCode and Aspose.PDF libraries) prior attaching). Also, which versions of the Aspose APIs you are using? We will check your issue soon.

Hi, We are using Aspose Barcode 24.6.0. We set the BarcodeReadQuality to Max.

My predecessor raised a ticket with you. I believe we are waiting for a reply: Ref. BARCODENET 39103
(Another related issue came out of this BARCODENET 39106)

Here’s some code:
// Results Object
List barCodes = new List(); // Simple Results
Aspose.BarCode.BarCodeRecognition.BarCodeConfidence confidence = _enumHelper.GetAsposeBarCodeConfidence(message.Documents[0].BarcodeReadConfidence);

// PDF Document
if (message.Documents[0].FileExtension.ToLower().EndsWith(“pdf”))
{
using (Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(message.Documents[0].FilePath))
{
await _apiAuditRepo.UpdateCoreApiMessageDocumentOcrPage(message.Documents[0].CoreApiMessageDocumentId, pdfDoc.Pages.Count);

    //create pdf converter
    Aspose.Pdf.Facades.PdfConverter pdfConverter = new Aspose.Pdf.Facades.PdfConverter(pdfDoc);
    pdfConverter.BindPdf(pdfDoc);
    pdfConverter.Resolution = new Aspose.Pdf.Devices.Resolution(300);
    pdfConverter.StartPage = message.Documents[0].StartPage;
    pdfConverter.EndPage = message.Documents[0].EndPage > 0 ? message.Documents[0].EndPage : pdfDoc.Pages.Count;
    pdfConverter.EndPage = pdfConverter.StartPage > pdfConverter.EndPage ? pdfConverter.StartPage : pdfConverter.EndPage;

    while (pdfConverter.HasNextImage())
    {
        try
        {   // Save image to stream
            using (MemoryStream imageStream = new MemoryStream())
            {
                pdfConverter.GetNextImage(imageStream);
                imageStream.Position = 0;

                using (BarCodeReader reader = new BarCodeReader(imageStream))
                {
                    // Set high performance
                    reader.QualitySettings = _enumHelper.GetAsposeBarCodeQuality(message.Documents[0].BarcodeReadQuality);

                    foreach (BarCodeResult barCodeResult in reader.ReadBarCodes())
                    {
                        if (confidence == BarCodeConfidence.None)
                        {
                            if (message.Documents[0].BarcodeRemoveControlChars)
                            {
                                barCodes.Add(new string(barCodeResult.CodeText.Where(c => !char.IsControl(c)).ToArray())); // Remove control / Unicode Chars
                            }
                            else
                            {
                                barCodes.Add(barCodeResult.CodeText);
                            }
                        }
                        if ((confidence == BarCodeConfidence.Moderate) && (barCodeResult.Confidence == BarCodeConfidence.Moderate || barCodeResult.Confidence == BarCodeConfidence.Strong))
                        {
                            if (message.Documents[0].BarcodeRemoveControlChars)
                            {
                                barCodes.Add(new string(barCodeResult.CodeText.Where(c => !char.IsControl(c)).ToArray())); // Remove control / Unicode Chars
                            }
                            else
                            {
                                barCodes.Add(barCodeResult.CodeText);
                            }
                        }
                        if ((confidence == BarCodeConfidence.Strong) && (barCodeResult.Confidence == BarCodeConfidence.Strong))
                        {
                            if (message.Documents[0].BarcodeRemoveControlChars)
                            {
                                barCodes.Add(new string(barCodeResult.CodeText.Where(c => !char.IsControl(c)).ToArray())); // Remove control / Unicode Chars
                            }
                            else
                            {
                                barCodes.Add(barCodeResult.CodeText);
                            }
                        }
                    }
                }
            }
        }

@JsonB,

I tested your scenario/case with the PDF file using latest versions (v24.11) of Aspose.PDF for .NET and Aspose.BarCode for .NET, it works fine and as expected. Both QR and EAN13 barcodes are recognized fine. Here is the simplest (runnable) sample code that I am using in WinForm app.
e.g.,
Sample code:

string pdfFile = "e:\\test2\\BarAndQR.pdf";

Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(pdfFile);

//create pdf converter
Aspose.Pdf.Facades.PdfConverter pdfConverter = new Aspose.Pdf.Facades.PdfConverter(pdfDoc);
pdfConverter.BindPdf(pdfDoc);
pdfConverter.Resolution = new Aspose.Pdf.Devices.Resolution(300);
pdfConverter.StartPage = 1;
pdfConverter.EndPage = 1;

while (pdfConverter.HasNextImage())
{
    try
    {   // Save image to stream
        using (MemoryStream imageStream = new MemoryStream())
        {
            pdfConverter.GetNextImage(imageStream);
            imageStream.Position = 0;

            using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader(imageStream))
            {
                // Set high performance
                //reader.QualitySettings = _enumHelper.GetAsposeBarCodeQuality(message.Documents[0].BarcodeReadQuality);
                reader.QualitySettings = Aspose.BarCode.BarCodeRecognition.QualitySettings.MaxQuality;

                foreach (Aspose.BarCode.BarCodeRecognition.BarCodeResult barCodeResult in reader.ReadBarCodes())
                {
                    MessageBox.Show(barCodeResult.CodeType + " : " + barCodeResult.CodeText);
                   
                }
            }
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Which versions of Aspose.PDF and Aspose.BarCode you are using? Please try the latest versions of the APIs if you are not already using them.