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

Free Support Forum - aspose.com

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


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.


8.1.zip (262.8 KB)


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");