We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Syncfusion Feedback

WebKit OPX

Introduction

Syncfusion’s PDF Library now supports HTML-to-PDF conversion using the advanced WebKit rendering engine. This converter can easily be integrated into any application of a .NET platform, such as WF, WPF, MVC, and Azure Cloud Service, to convert URLs, HTML strings, SVG, and MHTML to PDF.

Building the sample

The sample showcased here covers most of the important features of HTML-to-PDF conversion. To deploy the sample, you need to install the WebKit HTML converter, which is available in the link below.

WebKit HTML converter: https://www.syncfusion.com/downloads/latest-version

GitHub location of WebKit: https://github.com/syncfusion/SfQtWebKit

After the installation, the WebKitPath property of an instance of the WebKitConverterSettings class should be assigned to the QtBinaries directory in the installed location. By default, this will be the installed location.

$SystemDrive\Program Files (x86)\Syncfusion\WebKitHTMLConverter\xx.x.x.xx\QtBinaries

Alternatively, you can place the QtBinaries folder in the application bin folder, which needs no reference in the code behind.

Description

The PDF Library easily converts HTML to PDF. The converter is very reliable and provides full support for HTML tags, CSS, and JavaScript, and also for advanced HTML5 features like CSS3, Canvas, SVG, and web fonts.

Our PDF WebKit rendering is accurate and the result preserves all the graphics, images, texts, fonts, and layout of the original HTML document/webpage.

It does not require external dependencies like browsers, printer drivers, and viewers.

Documentation is available at: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit

Sample output:

Advanced WebKit rendering.

HTML-to-PDF features

  • Converts any webpage to PDF.
  • Converts any raw HTML string to PDF.
  • Prevents text and images from splitting across pages.
  • Converts HTML form to fillable PDF form.
  • Works both in 32-bit and 64-bit environments.
  • Automatically creates a table of contents.
  • Automatically creates bookmark hierarchy.
  • Converts only a part of a webpage to PDF.
  • Supports headers and footers.
  • Repeats HTML table header and footer in PDF.
  • Supports HTML5, CSS3, SVG, and web fonts.
  • Converts any HTML to MHTML.
  • Converts any HTML to SVG.
  • Converts any HTML to an image.
  • Supports accessing HTML pages using both HTTP POST and GET methods.
  • Supports HTTP cookies.
  • Supports cookies-based form authentication.
  • Is thread safe.
  • Supports internal and external hyperlinks.
  • Sets document properties, page settings, security, viewer preferences, etc.
  • Protects PDF documents with passwords and permissions.
  • c#
  • //Initialize HTML converter. 
    HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
    //WebKit converter settings. 
    WebKitConverterSettings webKitSettings = new WebKitConverterSettings();
    //Assign the WebKit binaries path. 
    //webKitSettings.WebKitPath = "QtBinaries";
    //Assign WebKit settings to converter settings. 
    htmlConverter.ConverterSettings = webKitSettings;
    //Convert URL to PDF document.
    PdfDocument document = htmlConverter.Convert("www.google.com");
    // Save and close the document.
    document.Save("Sample.pdf");
    document.Close(true);

    More information

    For more information, please refer to our UG documentation: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit