Problems reading QR-Code

Please have a look at the attached file “bad_code”. The barcode does can’t be read. The file “good_code” works fine - I cannot see any difference… Please help!

Thanks, Oliver


Using converter As New Aspose.Pdf.Facades.PdfConverter


converter.RenderingOptions.BarcodeOptimization = True


While converter.HasNextImage

Dim imageStream As New MemoryStream

converter.GetNextImage(imageStream, Drawing.Imaging.ImageFormat.Png)

System.IO.File.WriteAllBytes(“c:\test.png”, imageStream.GetBuffer())

Using barcodeReader As New Aspose.BarCodeRecognition.BarCodeReader(imageStream, Aspose.BarCodeRecognition.BarCodeReadType.QR + BarCodeReadType.Code128 + Aspose.BarCodeRecognition.BarCodeReadType.DataMatrix)

Do While barcodeReader.Read()

Dim barcodesString(1) As String

barcodesString(0) = barcodeReader.GetCodeText()


’ close the reader

If String.IsNullOrEmpty(result) Then result = “keine Codes gefunden”




End Using

End While

End Using

Hi Oliver,

Thank you for contacting support. We’ve tested your sample PDF document against the latest builds of Aspose.Pdf 9.3.0 and Aspose.BarCode 6.3.0. We can recognize QR code from “bad_code.pdf” file as follows:

int pageIndex = 0;

// bind the pdf

PdfConverter converter = new PdfConverter();


converter.RenderingOptions.BarcodeOptimization = true;

converter.Resolution = new Aspose.Pdf.Devices.Resolution(300);


while (converter.HasNextImage())



MemoryStream pageStream = new MemoryStream();

converter.GetNextImage(pageStream, ImageFormat.Png);

using (BarCodeReader reader = new BarCodeReader(pageStream, BarCodeReadType.QR))


while (reader.Read())


Console.WriteLine("Page#" + pageIndex + " Code Text: " + reader.GetCodeText() + " Type: " + reader.GetReadType());




Page#1 Code Text: 7G801001020570 Type: QR

We hope, this helps.

Thank you! The following line did it:
converter.Resolution = new Aspose.Pdf.Devices.Resolution(300)

Best regards, Oliver

Hi Oliver,

Thank you for your reply. It is nice to hear from you that it solved the recognition problem. Please feel free to ask if you have any question regarding Aspose.BarCode product family, we will be happy to help you.