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

Free Support Forum - aspose.com

System.OutOfMemoryException when converting docx (1500 pages) to pdf


I’m testing the last version of Aspose.Words (v. I’m trying to convert word document that consists of 1500 pages (1MB) to pdf. I’m getting System.OutOfMemoryException even though I have still about 4GB of RAM memory available when the exception occurs.

This is the code I’m using:

Document d = new Document(srcPath);

I have no problem with converting similar document with 1000 pages.
Is there any known limitation of document size that can be converted to pdf? I’m attaching the test document I’ve used.

Best regards,

Hi Jarek,

Thanks for your inquiry. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-7825 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Jarek,

Thanks for your patience. When dealing with very large and complex documents Aspose.Words sometimes had problems during saving resulting in out of memory exceptions, disk swapping and generally failures.

We have introduced an option (SaveOptions.MemoryOptimization) to optimize memory consumption during these scenarios. When its value is set to true it will improve document memory footprint but will add extra time to processing. This optimization is only applied during save operation.

Please use latest version of Aspose.Words for .NET 17.1.0 and following code example. Hope this helps you.

Document doc = new Document(MyDir + "1500str.docx");
PdfSaveOptions options = new PdfSaveOptions();
options.MemoryOptimization = true;
doc.Save(MyDir + "Out v17.1.0.pdf", options);