I am using the PDF and Barcode libraries to read barcodes inside of PDF files. The performance is very slow. On a mixed Color and B&W PDF file of 171 pages, it takes 34 minutes to read about 11 barcodes. Below is the code (mostly same from the examples). Is there a more efficient way of doing this operation?
Document pdfDocument = new Document(file);
// bind the pdf document
PdfExtractor pdfExtractor = new PdfExtractor();
MemoryStream pageStream = new MemoryStream();
Bitmap bm = new Bitmap(pageStream);
using (BarCodeReader reader = new BarCodeReader(bm,
new System.Drawing.Rectangle(25, 25, 1350, 860), BarCodeReadType.Pdf417))
reader.RecognitionMode = RecognitionMode.MaxPerformance;
textBox1.AppendText(“Page#” + pageIndex + “Code test: \n” + reader.GetCodeText());
Attached is a sample. This file took around 8 minutes for 120 pages. The same file converted to B/W took 2 minutes. I believe its related to how many color pages there are in the file. In the attached there are 12, but the production could range a lot more.
Any advice is appreciated.