Manage Memory Usage during HTML (containing SVG) to Word & HTML to PDF Conversions using Java

Problem: when we use Aspose output to save word files or PDF files, the memory will continue to increase and cannot be released. We used two versions of Aspose, Java and .Net, respectively

Project scenario: output HTML content to word file or PDF file. HTML content includes text, table, picture, SVG and other content. The content will be larger and there will be multiple output situations. The project program runs continuously in the form of service, and the output method is called when the output task is passed.

Version:Java v18.8 .Net v18.8

Demo(Java):
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(“”);
doc.save(“……/test.docx”);// doc.save(“……/test.pdf”)

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(“”);
Saveoptions saveoption = SaveOptions.createSaveOptions(SaveFormat.DOCX);

//Saveoptions saveoption = SaveOptions.createSaveOptions(SaveFormat.PDF);
saveoption.setMemoryOptimization(true);
doc.save(“……/test.docx”,saveoption);// doc.save(“……/test.pdf”,saveoption)

sos

@dhzhao2016,

Have you tried the latest version of Aspose.Words for .NET i.e. 20.3 (or Aspose.Words for Java 20.2) on your end? In case the problem still remains, please ZIP and upload your input HTML file or copy the HTML String causing the undesired behavior in Word document and attach it here for testing. We will then investigate the issue on our end and provide you more information.