We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF GetNextImage Slow


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?

//open document
Document pdfDocument = new Document(file);

// bind the pdf document
PdfExtractor pdfExtractor = new PdfExtractor();


while (pdfExtractor.HasNextImage())

MemoryStream pageStream = new MemoryStream();

pdfExtractor.GetNextImage(pageStream, ImageFormat.Png);
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;

while (reader.Read())
textBox1.AppendText(“Page#” + pageIndex + “Code test: \n” + reader.GetCodeText());



Hi there,

Thanks for your inquiry. We will appreciate it if you please share your sample PDF document here, so we will look into it and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal,

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.


Hi there,

Thanks for sharing your sample document. Please note your shared document is a scanned PDF. So when you process it for barcode recognition, API extracts each page and try to find barcode. So it is taking a long time.

However we have logged an investigation ticket PDFNEWNET-39030 in our issue tracking system to improve the image extraction time. We will keep you updated about this issue resolution progress.

Best Regards,