We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

java.lang.UnsupportedOperationException: javax.imageio.ImageIO can't find writer for output format: emf

I’m trying to convert a Word document to HTML and am getting the following error:


java.lang.UnsupportedOperationException: javax.imageio.ImageIO can't find writer for output format: emf
        at asposewobfuscated.bi.a(Unknown Source)
        at asposewobfuscated.bi.a(Unknown Source)
        at asposewobfuscated.bi.a(Unknown Source)
        at com.aspose.words.ig.a(Unknown Source)
        at com.aspose.words.ig.a(Unknown Source)
        at com.aspose.words.ig.a(Unknown Source)
        at com.aspose.words.gh.k(Unknown Source)
        at com.aspose.words.gh.j(Unknown Source)
        at com.aspose.words.gh.visitShapeStart(Unknown Source)
        at com.aspose.words.Shape.accept(Unknown Source)
        at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
        at com.aspose.words.Paragraph.accept(Unknown Source)
        at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
        at com.aspose.words.Body.accept(Unknown Source)
        at com.aspose.words.gh.a(Unknown Source)
        at com.aspose.words.gh.a(Unknown Source)
        at com.aspose.words.gh.writeBody(Unknown Source)
        at com.aspose.words.gh.a(Unknown Source)
        at com.aspose.words.gh.b(Unknown Source)
        at com.aspose.words.Document.a(Unknown Source)
        at com.aspose.words.Document.save(Unknown Source)
        at com.aspose.words.Document.save(Unknown Source)

The code looks like this:

Document document = new Document(input.getAbsolutePath());
document.acceptAllRevisions();
SaveOptions saveOptions = document.getSaveOptions();
saveOptions.setHtmlExportMetafileResolution(300);
saveOptions.setHtmlExportMetafileAsRaster(false);
saveOptions.setHtmlExportScaleImageToShapeSize(false);
saveOptions.setHtmlExportCssStyleSheetType(CssStyleSheetType.EMBEDDED);
document.save(new File(tmpDir, output.getName()).getAbsolutePath());

I would have thought that Aspose would not use ImageIO to save EMF documents. Any assistance would be appreciated.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I managed to reproduce the problem on my side and created new issue #7227 in our defect database. I will notify you as soon as it is fixed.

Best regards.

Hi,

Thanks for the report. It will help us to make Asose.Words better.

For temporary workaround you can use three options:

1. Your image in template doc is slightly cropped. If you remove this cropping – Aspose will save the metafile as expected – without changes.

2. You can re-enable saving metafiles to raster – at least your test picture saved to png properly.

3. Don’t use metafiles in template docs at all. Not all browsers work good with them, even MS IE.

Regards,

Thank you for the quick response. I tried removing the cropping on the image and it worked.

We have published new version of Aspose.Words for java. This version contains fix of issue #7227 you have reported earlier.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

You can download new version from here:

http://www.aspose.com/community/files/51/file-format-components/aspose.words/entry163963.aspx