Page margins are incorrect after conversion from MHT to TIFF using C#

Hi,

We are using Aspose.Words for conversion of the documents in different formats to images. Our customer encountered with the issue that Aspose.Words doesn’t save layout of source MHT file in output image. Please compare input HTML file and output TIFF file generated by Aspose.Words in attached ZIP. The layouts are completely different.

Our customer uses Aspose.Words 19.1 but I checked it using the latest version 20.2, the results are the same.

Thanks,
Roman

8.1.zip (262.8 KB)

@cap.aspose

Please note that Aspose.Words mimics the behavior of MS Word. If you convert your document (MHTML) to other file format using MS Word, you will get the same output.

In your document, the custom page size is set. Please use the following code example to get the desired output. Hope this helps you.

Document doc = new Document(MyDir + "8.1.mht");
doc.FirstSection.PageSetup.PaperSize = PaperSize.A4;
doc.FirstSection.PageSetup.LeftMargin = 72;
doc.FirstSection.PageSetup.RightMargin = 72;
doc.Save(MyDir + "20.2.tiff");