Free Support Forum - aspose.com

Document save problem

Hi,


When open the attached file with parametar String:
String path = “file.rtf”;
Document document = new Document(path);
document.save("/home/emisia/Desktop/opa.doc");
and then save it, works fine.

But, when open the file with parametar InputStream:
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(path);
Document document = new Document(inputStream);
document.save("/home/emisia/Documents/Word/Filter3/T_" + fileName);
the exception was thrown:
java.lang.OutOfMemoryError: Java heap space
at asposewobfuscated.BK.Uo(Unknown Source)
at asposewobfuscated.BK.Up(Unknown Source)
at asposewobfuscated.BK.write(Unknown Source)
at asposewobfuscated.BG.W(Unknown Source)
at asposewobfuscated.BG.write(Unknown Source)
at com.aspose.words.ZQV.write(Unknown Source)
at com.aspose.words.ZTE.M(Unknown Source)
at com.aspose.words.ZTE.Zh(Unknown Source)
at com.aspose.words.ZRM.Ã(Unknown Source)
at com.aspose.words.ZR0.ZZ(Unknown Source)
at com.aspose.words.ZR0.d(Unknown Source)
at com.aspose.words.ZR0.h(Unknown Source)
at com.aspose.words.ZQE.visitShapeEnd(Unknown Source)
at com.aspose.words.Shape.Z(Unknown Source)
at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
at com.aspose.words.Shape.accept(Unknown Source)
at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
at com.aspose.words.Paragraph.accept(Unknown Source)
at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
at com.aspose.words.Body.accept(Unknown Source)
at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
at com.aspose.words.Section.accept(Unknown Source)
at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
at com.aspose.words.Document.accept(Unknown Source)
at com.aspose.words.ZQE.Ã(Unknown Source)
at com.aspose.words.Document.Ã(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)

Can you check this and help me please?

Thanks,
Bojan

Hi Bojan,


Thanks for your inquiry. Perhaps, you’re using an older version of Aspose.Words; as with Aspose.Words v11.9.0, I was unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.9.0 and let us know how it goes on your side. I hope, this will help.

Best Regards,