Doc with 200KB image throws OutOfMemoryError when saving to PDF

Aspose.Words.9.7.0 for Java
Saving the attached document to PDF causes the error:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferByte.(DataBufferByte.java:58)
at java.awt.image.ComponentSampleModel.createDataBuffer(ComponentSampleModel.java:397)
at java.awt.image.Raster.createWritableRaster(Raster.java:938)
at java.awt.image.BufferedImage.getData(BufferedImage.java:1372)
at asposewobfuscated.jj.j(PalBitmap.java:446)
at asposewobfuscated.jj.i(PalBitmap.java:416)
at asposewobfuscated.lp.c(PdfImage.java:184)
at asposewobfuscated.lp.f(PdfImage.java:92)
at asposewobfuscated.lp.a(PdfImage.java:50)
at asposewobfuscated.mf.a(PdfResources.java:165)
at asposewobfuscated.mf.h(PdfResources.java:135)
at asposewobfuscated.lz.a(PdfPages.java:57)
at asposewobfuscated.ki.a(PdfCatalog.java:104)
at asposewobfuscated.kn.endDocument(PdfDocument.java:68)
at asposewobfuscated.md.endDocument(PdfRenderer.java:58)
at com.aspose.words.ahi.GU(PdfWriter.java:47)
at com.aspose.words.pg.a(FixedPageWriterBase.java:31)
at com.aspose.words.Document.a(Document.java:1269)
at com.aspose.words.Document.save(Document.java:704)
at com.aspose.words.Document.save(Document.java:664)
ERROR: JDWP Unable to get JNI 1.2 environment, jvm -> GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [.. / .. / .. / src / share / back / util.c: 820]

Best regards, Evgeniy

Hi,
Thanks for your inquiry. I cannot reproduce the problem on my side using the following code:

Document doc = new Document("C:\\Temp\\Test_03.doc");
doc.save("C:\\Temp\\out.pdf", SaveFormat.PDF);

In additional, when you open any document, Aspose.Words reads this document into DOM (Document Object Model). It is always requires more memory to build DOM in memory than the original file size.
Size of the document in memory depends on original file size, document complexity and file format.
I think, in your case, you should just increase memory heap.
Best regards.

Hi Andrey,
Thanks, it works now.
Best regards, Evgeniy