HTML to MHTML Conversion
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:
- Load the HTML file using HtmlDocument class
- Create an instance of MHTMLSaveOptions
- Use the ConvertHTML() method of Converter class to save HTML as an MHTML file. You need to pass the HTMLDocument, MHTMLSaveOptions, and output file path to the ConvertHTML() method to convert HTML to MHTML.
MHTMLSaveOptions allows you to customize the rendering process. You can specify the UrlRestriction, MaxHandlingDepth, etc. The following example shows how to use MHTMLSaveOptions and create a PDF file with custom page-size and background color: