HTML to MHTML Conversion

Contents
[ ]

In this article, you will find information on how to convert an HTML to MHTML and how to use MHTMLSaveOptions.

The static methods of the Converter class are primarily used as the easiest way to convert an HTML code into various formats. You can convert HTML to MHTML in your C# application literally with a single line of code!

The next example explains how to convert HTML to PDF by line by line:

  1. Load the HTML file using HtmlDocument class
  2. Create an instance of MHTMLSaveOptions
  3. Use the ConvertHTML() method of Converter class to save HTML as an MHTML file. You need to pass the HTMLDocumentMHTMLSaveOptions, and output file path to the ConvertHTML() method to convert HTML to MHTML.

Save Options

MHTMLSaveOptions allows you to customize the rendering process. You can specify the UrlRestrictionMaxHandlingDepth, etc. The following example shows how to use MHTMLSaveOptions and create a PDF file with custom page-size and background color:

To learn more about MHTMLSaveOptions please read Fine-Tuning Converters article.