Free Support Forum - aspose.com

ASPOSE Word not able to covert huge text file (>50MB) to PDF

Hi

We are trying to convert a huge text file > 50 MB into PDF.

Code ===
License wordsLicense = new License();

wordsLicense.setLicense("/usr1/pdfconverter-batch/Aspose.Words.lic");

Document doc = new Document(“Test.txt”);

doc.save(“test.PDF”);

We are getting Java heap error.

Should we split the text files in smaller file and then covert to PDF?

Thanks
Bhupesh

@bcbsma

Thanks for your inquiry. Please note there is no limitation of file size in Aspose.Words. Aspose.Words processes files in memory, so file size limitation for processing depends upon your system resources. Aspose.Words needs 10 times more memory than the original document size to build a DOM in the memory.

So it seems you are getting issue because your IDE Java heap space might not be enough for high memory spikes when processing large documents. In this case, the easy way to workaround is to increase the heap space for the JVM. You may increase JVM heap settings to -Xmx4G -Xms4G. It will work in most of the cases.

However, if the issue persists then please share your source file. You may share your file via some free file sharing service e.g. Dropbox, Google drive etc. We will look into the issue and will guide you accordingly.

A post was split to a new topic: Convert TXT to PDF