Problem converting pages in pdf to png


We have a pdf document and are trying to convert each page to a png thumbnail. I have used the code specified here:

I have specified an additional property to create thumbnail images of 300 x 300 pixels.

There are two problems that we are seeing:

  1. The pdfDocument.Pages.Count has a value of 100 for our 100 page pdf document. However, an index out of range exception is thrown when attempting to access page 6 (index 5) as the pdfDocument.Pages collection only contains 5 items.

  2. On a well spec’d development machine the first page takes 6.4 seconds to generate. The second page takes 3.6, third takes 3.7 and the forth takes 3.6 seconds. Is there anything that can be done to improve the speed at which these thumbnails are rendered?


I have replicated the problem with a 10 page document which I will try to upload

Hi there,

Thanks for your inquiry. I have tested the scenario using Aspose.Pdf for .NET 10.5.0 and unable to replicate the issue. Please download and try latest version of Aspose.Pdf for .NET it will help you to accomplish the task.

Moreover regarding processing time, Aspose.Pdf uses system memory for processing, so it depends upon the system resources and file size/contents.

Best Regards,