Word to HTML : the cropped image wholly showing in html result content

Hi,

Recently we noticed the cropped images in word file are not showing correctly in the html result, instead of showing the cropped area but stretched to fit the length.

This is the result html:
test.zip (10.1 KB)

This is the test file:
test_crop_image.docx (22.3 KB)

Can you provide us some guidance?

Thanks for advance.

@FSUPTC sorry I cannot replicate your issue, I’m using the latest version of Aspose.Words API (v23.4) and the following code:

var doc = new Aspose.Words.Document("C:\\Temp\\input.docx");

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
htmlSaveOptions.setExportOriginalUrlForLinkedImages(true),
htmlSaveOptions.setExportPageSetup(true),
htmlSaveOptions.setPrettyFormat(true),

doc.save("C:\\Temp\\output\\output.html", htmlSaveOptions);

output.zip (35.4 KB)

We are using Aspose.word for java 23.1.

@FSUPTC we don’t provide support of oldest versions of Aspose API, so can you please update to the latest version and test. If the error persist can you please provide more information about the environment in where the application is running and post the code that you are using.

I tried with the 23.4, but still get the same, here is the code snippet. We tested on Linux and Windows, both are the same.

SavedImageRename imageOption = new SavedImageRename("");
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions(SaveFormat.HTML);
htmlSaveOptions.setHtmlVersion(HtmlVersion.XHTML);
htmlSaveOptions.setExportPageMargins(false);
htmlSaveOptions.setExportDocumentProperties(true);
htmlSaveOptions.setImagesFolder(imagePath);
htmlSaveOptions.setImagesFolderAlias(relatedPath);
htmlSaveOptions.setExportOriginalUrlForLinkedImages(true);
htmlSaveOptions.setExportPageSetup(true);
htmlSaveOptions.setUseHighQualityRendering(true);
htmlSaveOptions.setExportRoundtripInformation(false);
htmlSaveOptions.setExportHeadersFootersMode(ExportHeadersFootersMode.PER_SECTION);
htmlSaveOptions.setImageSavingCallback(imageOption);
htmlSaveOptions.setScaleImageToShapeSize(false);

Can you please include the code of this class?

please set the above value to true it should fix the issue.

That’s weird as it worked fine with 22.12.

Does this option will compress the image/resolution loss?

@FSUPTC yes and no, that depend on the original quality of the image, also the Aspose algorithm to change the size of the images tend to be better than the regular algorithm used by the browsers. Check here for further explanation.
I also going to open a Ticket for our dev team because the use or not of the property ScaleImageToShapeSize should not affect the final result.

@FSUPTC
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25292

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Great, thanks!