简体   繁体   中英

heap size error Aspose

while converting a docx file in pdf file using Aspose i got this heap size error.here is the code
this docx file is 44Mb

public void convertDoc(String Path, String destPath) throws Exception{


        Document doc = new Document(Path); //At this line heap size error comes
        doc.save(destPath);
        System.out.println("doc converted to pdf");

        }

Any suggestions?

Increasing the heap size should fix the issue.

If it doesn't, then check if you have high resolution images in your Word document. I have converted very large DOC files to PDF (without high res images) under 512 MB memory. But, some of the documents, even less than 50 pages, but having large sized images, they require large memory, even upto 3GB!!

Possible solutions:

  • Replace the images inside your document using Aspose.Words with smaller, resized images
  • If the document has multiple sections, split the document by section and convert to PDF separately. This would of course later require the merging of PDF files.

I work as a Developer/Evangelist at Aspose.

Since you are loading a document larger than the heap size you will have to increase the heap size while running the program like this

 java -Xmx512M myprogram

If you are using eclipse go to Run -> Run Configurations and under Arguments Tab type -Xmx512m and click on RUN

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM