I have a PDF file which was created from a fax image that includes a QR barcode on the page and the .Net 5.6 BarCodeRecognition component is not recognizing the barcode that exists on the page. I have included the pdf file as an attachment in this post.
Hi Rob,
// bind the pdf document<o:p></o:p>
PdfExtractor pdfExtractor = new PdfExtractor();
pdfExtractor.BindPdf("PDF+Upload+-+failure.pdf");
Console.WriteLine("Extracting images.....");
pdfExtractor.ExtractImage();
int i = 0;
// save images to stream in a loop
while (pdfExtractor.HasNextImage())
{
i++;
// save image to stream
MemoryStream imageStream = new MemoryStream();
pdfExtractor.GetNextImage(imageStream, ImageFormat.Png);
using (BarCodeReader barcodeReader = new BarCodeReader(imageStream, BarCodeReadType.QR))
{
barcodeReader.ImageBinarizationHints = RecognitionHints.ImageBinarization.MedianSmoothing;
while (barcodeReader.Read())
{
Console.WriteLine(i + " Codetext found: " + barcodeReader.GetCodeText() + ", Symbology: " + barcodeReader.GetReadType().ToString());
}
}
}
Thanks for the reply, making this code change worked perfectly.
Hi Rob,