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

Free Support Forum - aspose.com

Slowness from PngDevice.process and pdf.page.addStamp

Quite new to Aspose API. Can anybody kindly point out why the following two pieces of code take so long to complete? Anything could be done to improve the processing time?


The code running under RHEL 6.4 X86-64 on a Dell P/E Server with JDK 1.7 with dual Xeon CPU of 8 cores and 16GB RAM.




Thank you!


1) Convert Pdf file to Png using Aspose pdf for java, the pdf file size is 75.6K, height=793px, width=612px, using the resolution=300(look at the code), convert to image is Height=3300px, Width=2550px, size is 158K. the following code take almost 7s.

PngDevice pngDevice = new pngDevice(imgResolution);
pngDevice.process(page, imageStream); <-------- //here take about 7s

2) Add background also take about 10s. the png image is the same as above. The input pdf file size is 75K, added background pdf file size is 250K. both of the pdf files height and width are the same as above

Document doc = new Document(pdfFileName);
ImageStamp imageStamp = new ImageStamp(imgFileName);
com.aspose.pdf.Page page = doc.getPages().get_Item(1);
double height = page.getRect().getHeight();
double width = page.getRect().getWidth();
imageStamp.setHeight(height);
imageStamp.setWidth(width);
page.addStamp(imageStamp); <---- //here take about 10s.

Hi Dean,


<o:p></o:p>

Thanks for your inquiry. While testing the scenario with the latest version of Aspose.Pdf for Java 4.4.0, We have also noticed the performance issue in PDF to PNG conversion and adding Image stamp in a PDF document as compare to Aspose.Pdf for .NET API. So we have logged following investigation ticket in our issue tracking system for performance enhancement. We will notify you via this thread as soon as these are resolved.


PDFNEWJAVA-33909: PDF to PNG conversion performance issue

PDFNEWJAVA-33910: Image Stamp performance issue

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNEWJAVA-33910) have been fixed in Aspose.Pdf for Java 11.0.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.