Articles in this section
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

  1. Syncfusion.Compression.Base.dll
  2. Syncfusion.HtmlConverter.Base.dll
  3. Syncfusion.Pdf.Base.dll
  4. 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

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied