Free Support Forum -

Aspose.Words for Java: metafile export not working in HtmlSaveOptions


after upgrading to Aspose.Words fpr Java 10.0.1 (we were using the beta version before), we noticed that the raster export for metafiles still doesn't work when saving a Document using the HtmlSaveOptions.

Sample code (sample document containing EMF and WMF images is attached):

File wordFile = new File(System.getProperty("user.home") + "/desktop/EMF+WMF Graphics Test.docx");

Document doc = new Document(wordFile.getAbsolutePath());

HtmlSaveOptions saveOptions = new HtmlSaveOptions();

File converted = new File(wordFile.getParentFile(), "converted.html");, saveOptions);

The images (converted.001.png and converted.002.png) are empty (all pixels transparent), so the raster export obviously doesn't work. When attempting to keep them as metafiles ( saveOptions.setExportMetafileAsRaster(true);), we get the same result: two empty png raster files.
In the beta version of Aspose.Words for Java, the non-raster export was also buggy (it exported the correct metafiles, but gave them a wrong file ending (.png)), but the final version doesn't even write the metafile content.

The missing metafile export is a big issue for us and our clients, as we can't even use the workaround with adding an ImageSaveingCallback and then converting the meta files, as Java (contrary to .Net) doesn't provide metafile rendering capabilities.

Can you please address this issue in one of the next bugfixing patches?

Many thanks,
Peter Walser | Software Architect | Abraxas Juris AG


Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.

As I can see this problem does not occur in .NET version of Aspose.Words. So I think it will be fixed when Aspose.Words for Java will come out of Beta.

Best regards,

The issues you have found earlier (filed as WORDSJAVA-34) have been fixed in this .NET update and in this Java update.

Dear Aspose Team

The issue still isn’t fixed, the images that are created when selecting the raster export option contain just a rectangle with a gray gradient and an error symbol. :frowning:

Tested with: Aspose.Words for Java, 10.4.0, and the test document attached to the original post.
I attached a ZIP with the original document containing the EMF and WMF graphics, and the resulting HTML file plus the two raster images (PNG), hopefully this helps you replicate and resolve this problem.

Thanks in advance,

Peter Walser
Software Engineer/Architect


Thanks for your request. But unfortunately, I cannot reproduce the problem on my side. I attached the output HTML produced on my side.

In addition, you can try installing JAI on your side. This might help to resolve the problem.

Best regards,