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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

HTML to PDF Overview

The HTML-to-PDF converter is a Blazor library for converting webpages, SVG, MHTML, and HTML files to PDF using C#. It uses popular rendering engines such as Blink (Google Chrome) and WebKit. It is reliable and accurate. The result preserves all graphics, images, text, fonts, and the layout of the original HTML document or webpage.

Our HTML-to-PDF converter will work seamlessly in various platforms like Azure Cloud or web apps, Azure Functions, Amazon Web Service (AWS), Docker, WinForms, WPF, ASP.NET MVC, ASP.NET Core with Windows, Linux, and MacOS.

Overview of HTML to PDF for Blazor


The Blazor HTML-to-PDF converter with Blink engine allows you to convert HTML file, HTML string, URL, ASPX, Razor, MVC View to PDF with just a few lines of code.

using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;

HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink);
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
//Set the BlinkBinaries folder path and assign Blink converter settings to HTML converter.
blinkConverterSettings.BlinkPath = @"/BlinkBinaries/";
htmlConverter.ConverterSettings = blinkConverterSettings;
//Convert URL to PDF and save the PDF document. 
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save and closes the PDF document.
MemoryStream stream = new MemoryStream();
document.Save(stream);
document.Close(true);
Imports Syncfusion.Pdf
Imports Syncfusion.HtmlConverter

'Initialize the HTML to PDF converter with Blink rendering engine
Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink)
Dim blinkConverterSettings As BlinkConverterSettings = New BlinkConverterSettings()
'Set the BlinkBinaries folder path and assign Blink converter settings to HTML converter.
blinkConverterSettings.BlinkPath = "/BlinkBinaries/"
htmlConverter.ConverterSettings = blinkConverterSettings
'Convert URL to PDF and save the PDF document. 
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and closes the PDF document.
Dim stream As MemoryStream = New MemoryStream()
document.Save(stream)
document.Close(True)

Convert HTML to PDF using WebKit rendering engine

The Blazor HTML-to-PDF converter with WebKit engine allows you to convert HTML file, HTML string, URL, ASPX, Razor, MVC View to PDF with just a few lines of code.

using Syncfusion.Pdf;
using Syncfusion.HtmlConverter;
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);

WebKitConverterSettings settings = new WebKitConverterSettings();
//Set the WebKit path and assign WebKit settings to the HTML converter.
settings.WebKitPath = @"/QtBinaries/";
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF and aave and close the PDF document. 
PdfDocument document = htmlConverter.Convert("https://www.google.com");
//Save and closes the PDF document.
MemoryStream stream = new MemoryStream();
document.Save(stream);
document.Close(true);
Imports Syncfusion.Pdf
Imports Syncfusion.HtmlConverter

'Initialize the HTML to PDF converter 
Dim htmlConverter As New HtmlToPdfConverter(HtmlRenderingEngine.WebKit)
Dim settings As New WebKitConverterSettings()
'Set WebKit path and assign WebKit settings to the HTML converter.
settings.WebKitPath = "/QtBinaries/"
htmlConverter.ConverterSettings = settings
'Convert URL to PDF and save the PDF document.
Dim document As PdfDocument = htmlConverter.Convert("https://www.google.com")
'Save and closes the PDF document.
Dim stream As MemoryStream = New MemoryStream()
document.Save(stream)
document.Close(True)

General information

Powerful and comprehensive API

The comprehensive API makes it possible to convert richly formatted HTML strings or webpages to PDF.

Blazing-fast performance

Optimized for usage in a server environment where speed and low memory usage are critical.

Fully documented

The Blazor HTML-to-PDF converter includes extensive documentation, a knowledge base, and samples.


HTML-to-PDF conversion

Convert HTML to PDF files in CSharp.NET

Convert HTML to PDF files in C

The Blazor HTML-to-PDF converter allows you to convert URLs, HTML5, CSS, CSS3, and HTML to PDF with just five lines of C# code.

Partial webpage HTML to PDF in Blazor

Partial webpage to PDF

A part of a webpage can be converted to PDF based on the HTML tag ID.

Preserves format when converting HTML to PDF in Blazor

Preserves format

The PDF will look just like the webpage you converted. It preserves all graphics, images, text, fonts, links, and the layout of the original HTML document or webpage.

JavaScript execution in converting HTML to PDF.

JavaScript execution

HTML can be converted to PDF with or without JavaScript execution during conversion.


Hyperlink toggle in converting HTML to PDF in Blazor

Hyperlinks can be toggled when converting HTML to PDF documents.

Converting HTML form to PDF form in Blazor

HTML form to PDF form

Convert an HTML form to a PDF form and preserve its exact position, size, and appearance. In addition, preserve the values of the HTML form fields.

Bookmarks created on converting HTML to PDF in Blazor

Bookmarks

Bookmarks are created automatically in a PDF document based on the HTML heading tags from <h1> to <h6>.

Table of contents created on converting HTML to PDF in Blazor

Table of contents

A table of contents will be created automatically in a PDF document based on the HTML heading tags from <h1> to <h6> with default styles. You can also apply custom styles to the table of contents.


Converting Windows authentication HTML page to PDF.

Windows authentication

Windows-authenticated webpages can be converted to PDF with a username and password in the converter.

Converting form authentication HTML page to PDF.

Form authentication

Form-authenticated webpages can be converted to PDF by using cookies in the converter settings.

Converting token-based authentication HTML page to PDF.

Token-based authentication

Token-based authenticated webpages can be converted to PDF by using bearer tokens in the converter’s HTTP request header.

HTML to PDF converter supporting media types.

Media type

The Blazor HTML-to-PDF converter supports both screen and print media types in conversion using C#.


Viewport customization on converting HTML to PDF.

Viewport customization

Convert HTML to PDF based on your desired viewport size.

Proxy setting available in HTML-to-PDF converter.

Proxy

System and manual proxy settings are available to convert HTML to PDF using C#.

Offline conversion support in HTML-to-PDF converter.

Offline conversion

Convert HTML to PDF with the available offline data by ignoring the online resources.

SVG to PDF support in HTML-to-PDF converter in Blazor

SVG to PDF

SVG files or SVG elements in HTML can also be converted to PDF.



Feature Comparison

>
Feature WebKit Blink
Convert a webpage to PDF in C# Yes Yes
Convert HTML string to PDF in C# Yes Yes
Convert partial webpage to PDF Yes Yes
Toggle JavaScript execution during conversion Yes Yes
Hyperlinks Yes Yes
Page breaks Yes Yes
Handle text and images split across pages Yes Yes
Header and footer Yes Yes
Repeat HTML table header/footer Yes Works only with print media
Viewport Yes Yes
HTML5/CSS3 Yes Yes
Windows authentication Yes Yes
Form authentication Yes Yes
Token-based authentication Yes Yes
Offline conversion Yes Yes
Additional delayYes Yes
Auto create bookmarks Yes Yes
Auto create table of contents Yes Yes
Print media type Yes Yes
HTML form to PDF form Yes Yes
HTTP get and post Yes Yes
System proxy Yes Yes
Manual proxy Yes Yes
HTML to single PDF page Yes Yes
Layout result (height of HTML content) Yes Yes
Window status Yes Yes
HTML to image Yes Yes
HTML to SVG Yes
HTML to MHTML Yes
SVG to PDF Yes Yes
Page settings Yes Yes
Document protection Yes Yes
ActiveX plugin Yes Yes
Watermarks Yes Yes
Supported cloud platforms
Azure App Services Yes Works in Azure App Service on Linux
Azure Functions Yes Works in Azure Function on Linux
Azure Cloud Services Yes Yes
Azure Web APP for Containers Yes Yes
Amazon Container Services (ECS) Yes Yes
AWS Lambda Yes

Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.

Scroll up icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon