Free Support Forum -

Getting Out of memory error from ASPOSE

Hi there,

We are getting out of memory error while trying to converting attached file into HTML content using ASPOSE API, even though the size of the file is not too large and could not find any large image embedded in it. Could you please help us understanding the cause of this issue? PFB the stack trace.


at com.sun.imageio.plugins.png.PNGImageReader.readMetadata(

at com.sun.imageio.plugins.png.PNGImageReader.readImage(



at asposewobfuscated.bp.d(

at asposewobfuscated.bp.a(

at asposewobfuscated.bp.b(

at asposewobfuscated.bp.b(


We are using the old version of ASPOSE, the code to convert file into HTML content is as below.

Document destdocument = new Document(file_input_stream);

destdocument.getSaveOptions().setHtmlExportImagesFolder(strFolder);, SaveFormat.HTML);



This message was posted using Email2Forum by aske012. (attachment)

Hi Ashish,

Thanks for you inquiry.

I have tried reproducing issue on my end using your input word document, but was not able to reproduce any issue with the latest version (ver 11.11.0) of Aspose.Words for Java. The code you have used is tweaked a bit and here is the updated code used by us during verification of issue:

String csPath = "C:/TempFolder/";

// Open the stream and Document. Read only access is enough for Aspose.Words to load a document. InputStream stream = new FileInputStream(csPath + "Advanced+Services+Style+Guide-1.docx"); Document destdocument = new Document(stream);

// This is the directory we want the exported images to be saved to. File imagesDir = new File(csPath, "Images");

// The folder specified needs to exist and should be empty. if (imagesDir.exists()) imagesDir.delete();

// Set an option to save as HTML and specify Images directory. HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.HTML); options.setImagesFolder(imagesDir.getPath());

// Save output HTML OutputStream htmlStream = new FileOutputStream(csPath + "Advanced+Services+Style+Guide-1.html");, options);

The generated html document along with the Images directory is attached in the zip file to the reply also. I would also recommend you to please use the latest version of Aspose.Words for Java. You can download latest version here.

Hope this helps. Please do let us know how does it go on your side or if you have any more queries.