Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Performance issue about convert pdf to png and add background to pdf using Aspose pdf for Java

$
0
0

Hi,

 

There are two processing slow:

 

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 almose 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 file’s height and width is 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.

 


Viewing all articles
Browse latest Browse all 3131

Trending Articles