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

Free Support Forum - aspose.com

Html to Word doc images have fuzzy resolution

Hi,

I’m trying to convert an HTML document to a Word document. It seems that the images are converted to the wrong resolution. Here’s an example.

What happens is that the image gets shrunken to 720 wide x 540 tall. If you do a “Save as Picture” in Word, you can see that resolution. But then Word scales it back up to 960 x 720 in the document, and it just looks a little fuzzy.

Is there some setting that we’re missing to convert things correctly?

Here’s our Java code:

Document doc;
License license = new License();

    license.setLicense(ClassLoader.getSystemResourceAsStream("Aspose.Words.lic"));
    LoadOptions loadOptions = new LoadOptions();
    loadOptions.setBaseUri(urlToSource);
    loadOptions.setEncoding(Charset.forName("UTF-8"));

    if (htmlDocumentPath != null) {
        doc = new Document(new FileInputStream(new File(htmlDocumentPath)), loadOptions);
    } else {
        doc = new Document(ClassLoader.getSystemResourceAsStream("audit_report.html"), loadOptions);
    }
    if (outputPath != null) {
        doc.save(outputPath + "/AuditReport.docx", SaveFormat.DOCX);
        return "Saving Document to " + outputPath + "/AuditReport.docx";

    } else {
        doc.save("./AuditReport.docx", SaveFormat.DOCX);
        return "Saving Document to AuditReport.docx";
    }

Hi Rex,

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

Look at https://github.com/rexmadden/aspose-image-resolution-bug

There’s an example Word doc and image in there that are scaled funny. The Main.java will also recreate it. Using the latest Aspose Words 14.12.0

Hi Rex,

Thanks for your inquiry. I have tested again the same scenario and have not found the shared issue. Please check the attached images for detail. Moreover, I have not found this issue with your shared document (image_bug.docx).

Could you please open the shared image-bug.html in MS Word and save it to Docx using MS Word and repeat the same scenario? Please also share which MS Word version you are using. I have checked the output document in MS Word 2013.