We Aspose to convert the bulk scanned files into a single pdf document. We use Aspose barcode reader to read the information contained in each QR code.
Each page of the file is created by Aspose as an image.
Sometimes a QR code is not found by the barcode reader, maybe it is too faint, too small, or perhaps it was resized prior to insertion into the document.
Is there ANY way we can identify that a barcode is there but just couldn't be read?
Thanks for your inquiry. Could you please share your sample code and source document here? So we will look into the issue and provide you more information accordingly.
...The following is an excerpt of the code. If all the barcodes are readable, then the original pdf file is successfully split into separate pdf documents. If a barcode inside the document is not recognized, then it will just be included with the document that started with a valid barcode.
////bind the pdf document Aspose.Pdf.Facades.PdfExtractor pdfExtractor = new Aspose.Pdf.Facades.PdfExtractor(); pdfExtractor.BindPdf(fs);
for (i = 1; i<=docNumberOfPages; i++) { Console.Write("\nPage " + i.ToString()); //get every valid barcode.
barcodeText = GetBarcodeText(pdfExtractor, i); if (barcodeText != string.Empty) { //validate validbarcode = ValidateBarcode(barcodeText); if (validbarcode) { if (prevDocBarCodeText == "") { prevDocBarCodeText = barcodeText; docFirstPage = i; validbarcode = true; } else //this is the first page of the next document { docLastPage = i - 1;
//CreateNewDoc creates the new pdf document and returns the filename created filesCreated = filesCreated + "\n " + CreateNewDoc(fs, docFirstPage, docLastPage, FilePath, prevDocBarCodeText, DocumentLibraryPath, upload); prevDocBarCodeText = barcodeText; docFirstPage = i;
//reset upload flag so rest of documents with valid barcodes will upload//reset flag so rest of documents with valid barcodes will upload upload = true; } if (i == docNumberOfPages) { //this is also the last page docLastPage = i; Console.WriteLine(" -- Last Page!\n\n"); filesCreated = CreateNewDoc(fs, docFirstPage, docLastPage, FilePath, prevDocBarCodeText, DocumentLibraryPath, upload); } } }
**************************Remaining code to handle what page I'm on and what I want to do.
Thanks for sharing code sample. Can you please also share a sample problematic document here? So we will test it and share the information accordingly.
I’m representative of Aspose.BarCode product family.
Thanks for sharing the sample document. First off, please try to use the latest version of Aspose.BarCode for .NET 5.4.0 because each new release contains many improvements, bug fixes and new features. So, we suggest you always use the latest versions of Aspose products. You can download it from here:
I tested your sample Pdf file against the latest version of Aspose.BarCode for .NET 5.4.0 and Aspose.Pdf for .NET 7.7.0 components. I would like to update you that I am able to recognize the barcode. Please follow up the source code below:
In addition, I’m not sure about what the GetBarCodeText method is returning in your source code. In case the barcode is not recognized and GetBarCodeText method is returning an empty string then you are creating a PDF document within the condition like:
if (barcodeText != string.Empty)<o:p></o:p>
In case of ambiguity, please share the entire source code. We will take a closer look and guide you accordingly.
As per my understanding, you are extracting the image from PDF file using PdfExtractor and then using Barcode reader to read the barcode. Whereas 20130219130306948.pdf is the file which is causing issue when image is extracted from this file and barcode is not properly understanding/recognizing the QR code.
I have tested the scenario where I have used Aspose.Pdf for .NET 7.7.0 to extract image from attached PDF file and as per my observations, the resultant image is fine and barcode is properly appearing. For your reference, I have also attached the resultant image file. We are sorry for this inconvenience.
In case I have not properly understood your requirement, please share some further details.
Thank you for these details. It is nice to hear from you that you are able to recognize barcode images. Please feel free to ask if you have any question about Aspose products, we will be happy to help you.