DOCX to PDF conversion takes much time using Java when DOCX size is more than 10 MB

Aspose team we have written a routine in java for our client converting all word documents to PDF. There are some client word documents on which un responsive behavior is observed. Neither library throws any error nor does it converts these documents.

Routine fails on following line + “securepdf.pdf”, ApplyPDFSecurity(doc));

These documents have scanned copies on each page as images. These scanned copies are overlapped on each other. Document size is approximately 10 MB and 5 pages. Due to binding with the client document cannot be shared and we are unable to replicate the issue by creating any new documents.

Please suggest how problem should be solved. Has it been highlighted before by any client. (835 Bytes)


We suggest you please use SaveOptions.MemoryOptimization property to optimize the memory performance. Setting this option to true can significantly decrease memory consumption while saving large documents at the cost of slower saving time. Hope this helps you.

If you still face problem, please ZIP and attach your input document here for testing. We will investigate the issue and provide you more information on it. (457.0 KB)

Dear, issue still has not been resolved. I am still facing issue in conversion of some word documents (doc, docx, docm) into pdf using Aspose.Word.20.x.
Code hangsup and don’t returns the control to the main thread of application. Code snippets is also pasted below. Sample documents are attached which are creating problems, with these three word formats.

Document doc = new Document(“E:\dev\sample\problematic.doc”);
//Document doc = new Document(“E:\dev\sample\problematic.docx”);
//Document doc = new Document(“E:\dev\sample\problematic.docm”);
PdfSaveOptions saveOptions = new PdfSaveOptions();
PdfEncryptionDetails encryptionDetails = saveOptions.getEncryptionDetails();
saveOptions.setEncryptionDetails(encryptionDetails);“E:\dev\sample\problematic_secure.pdf”, saveOptions);

also please share SaveOptions.MemoryOptimization correct usage procedure


Please check the following code example.

Document doc = new Document(MyDir + "problematic.docm");
PdfSaveOptions saveOptions = new PdfSaveOptions();
PdfEncryptionDetails encryptionDetails = saveOptions.getEncryptionDetails();
saveOptions.setMemoryOptimization(true); + "problematic.docm.pdf", saveOptions); 

We have not found the shared issue while using the latest version of Aspose.Wrods for Java 20.6. So, please use Aspose.Wrods for Java 20.6. We have attached the output PDF files with this post for your kind reference.