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

Free Support Forum - aspose.com

Performance Issue with 'Aspose.Pdf for Java' API

We are using aspose pdf API (Aspose.Pdf for Java) & this API hitting the worst performance of our application for pdf creation/merging…specially with optimization. we are using OptimizationOptions with strategies set like removeUnusedObjects, linkDuplicateStreams, compressImages, imageQuality and its taking huge time in creation/merging the pdf pages…for example for merge the 5 pages pdf at the end of each 30 pages pdf taking around 8 minutes. This is minimum we tested, we need 100+ pages pdf to merge with 30 pages pdf at the end of each page. Please help to improve the performance with Aspose.Pdf for Java as its taking huge time & failing with OutOfMemory. It consumes whole memory & sometime throw OutOfMemory. Please help to improve the performance & stop OutOfMemory.


com.aspose.pdf.Document finalPDFDoc = new com.aspose.pdf.Document();

com.aspose.pdf.Document docToBeAppended = new com.aspose.pdf.Document(module.getLoc());
finaPDFDoc.getPages().add(docToBeAppended.getPages());
OptimizationOptions opt = new OptimizationOptions();
opt.setRemoveUnusedObjects(true);
opt.setLinkDuplcateStreams(true);
finaPDFDoc.optimizeResources(opt);
finaPDFDoc.save();

Hi Yogesh,


Thanks for your inquiry. I have tested the scenario using your sample code with my sample PDF documents and Aspose.Pdf for Java 11.3.0 but I am unable to notice the performance issue. It is taking almost 12 seconds at my end, to merge and optimize the PDF documents. We will appreciate it if you please share your sample PDF document here, so we will look into the scenario again and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,