Free Support Forum - aspose.com

Image quality issue while saving word document as HTML file

We are saving Word documents as HTML files and then we are using HTML to build the website page. But we are having issues with some images while saving documents as HTML files, most of the images are getting saved as it is(means same size and dimensions in the word file). But, Image quality is getting reduced for some of the images and they converted into small sizes and dimensions. I have also tried with setting property ScaleImageToShapeSize to false, but we are still getting issues. We want all the images in the same quality, size, and dimension, the way they are in the word document. we don’t want any scaling.

Any pointer toward solution and suggestion will be really helpful. Thanks.

@kushalpaliwal847

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output HTML file that shows the undesired behavior.
  • Please attach the expected output HTML file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

@tahir.manzoor Please find attached zip. This is having all the required details and files. Please see console app console for details of the output folder and input file.

Please feel free for any additional details or inputs. Thanks.
AsposeWordToHtml.zip (1.7 MB)

@kushalpaliwal847

Please use HtmlSaveOptions.ScaleImageToShapeSize property as shown below to get the desired output. Please check the detail of this property from here:

Document doc = new Document(MyDir + "Omdia Market Radar for Next-Generation Application Security - Runtime v4.docx");

// join runs with same formatting in all paragraphs of the document
doc.JoinRunsWithSameFormatting();
HtmlSaveOptions options = new HtmlSaveOptions
{
    ScaleImageToShapeSize = false
};

// save DOC as a HTML
doc.Save(MyDir + "21.4.html", options);

Thanks, @tahir.manzoor for the inputs. Actually, We are using Aspose.Words.20.8.0 currently and ScaleImageToShapeSize property is not working with Aspose.Words.20.8.0. When we updated the version to Aspose.Words.21.5.0, we are able to get proper images with ScaleImageToShapeSize as false.

Now we just want to ensure that Aspose licensing is not version-specific and we can upgrade from Aspose.Words.20.8.0 to Aspose.Words.21.5.0 without any licensing implication.

Thanks

@kushalpaliwal847

You can check the expiry date of your license by opening the license file in notepad. You will see the following tag in your license file:

<SubscriptionExpiry>20220405</SubscriptionExpiry>

It means that you can free upgrade to a version of Aspose.Words that is published before 5th April 2022.