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

Free Support Forum - aspose.com

PngDevice slow performance

Hi. Can you suggest the fastest ever solution for convert PDF document pages to images? For example, now we using PngDevice class, but it’s work very slow, especially when PDF pages contains colored graphic. For example, converting this 10-pages PDF1.pdf (2.1 MB), generated from Power Point, takes ~20 seconds on our hardware (2 second per page).
I’am also try ConvertToPNGMemoryStream() method, but its also works slow. Does some alternative way?


Thanks for contacting support.

We have tested the scenario in an environment i.e. Core i5 2.4GHz, 8GB RAM, Windows 10 EN x64, Aspose.PDF for .NET 19.1 and Console Application Debug x64 and were unable to notice any issue as following code snippet took ~22 seconds for generation of images from your PDF document.

Document pdfDocument = new Document(dataDir + "1.pdf");
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
 string tmpImgToInsert = pageCount + "_" +
 DateTime.Now.Ticks + ".png";
 using (FileStream imageStream = new FileStream(dataDir + tmpImgToInsert, FileMode.Create))
  // Create Resolution object
  Resolution resolution = new Resolution(120);
  // Create PNG device with specified attributes
  PngDevice pngDevice = new PngDevice(resolution);
  pngDevice.RenderingOptions = new RenderingOptions() { ScaleImagesToFitPageWidth = true };
  // Convert a particular page and save the image to stream
  pngDevice.Process(pdfDocument.Pages[pageCount], imageStream);
Console.WriteLine("Total seconds taken : " + sw.Elapsed.TotalSeconds);

For your kind reference, screenshot of console output is also attached.

TotalSeconds.png (1.6 KB)

Would you please use latest version of the API in your environment and in case you still face any issue, please share your complete environment details along with sample console application. We will test the scenario in our environment and address it accordingly.

Don’t you think that 20 seconds is too much?


The performance of the API depends upon many factors to be noticed like Document Structure and Complexity, Graphics in the Document, Environment in which you are using the API, API version. Would you please share you complete environment details with us. We will log an investigation in our system and investigate the scenario in details.