Category / Section
How to convert MHTML to PDF using WebKit?
1 min read
The MHTML file can be converted to WinForms PDF using WebKit HTML Converter. Please find the code example and sample below for the same.
Assemblies Required
- Syncfusion.Compression.Base.dll
- Syncfusion.HtmlConverter.Base.dll
- Syncfusion.Pdf.Base.dll
- QtBinaries folder
All the above-mentioned assemblies can be get by installing the WebKit installer available in the below link.
WebKit HTML Converter: https://www.syncfusion.com/downloads/latest-version
//Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit); WebKitConverterSettings settings = new WebKitConverterSettings(); //Set WebKit path settings.WebKitPath = @"../../QtBinaries/"; //Assign WebKit settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert a MHTML file to PDF with HTML converter PdfDocument document = htmlConverter.Convert(@"../../Sample.mhtml"); //Save and close the PDF document document.Save("Output.pdf"); document.Close(true);
Sample Link:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/MHTMLToPDF366440886