Syncfusion Feedback

Trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

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

The HTML-to-PDF converter works seamlessly in various platforms: Azure App Services, Azure Functions, AWS Lambda, Docker, WinForms, WPF, .NET, ASP.NET MVC, ASP.NET Core with Windows, Linux, and MacOS.

Convert HTML to PDF using C#

The following code demonstrates how to convert an HTML file to a PDF document using C#.

//Initialize the HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
//Convert URL to PDF document
PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com");
//Create the file stream to save the PDF document
FileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite);
//Save and close the PDF document
document.Save(fileStream);
document.Close(true);

Key functions of HTML to PDF

Explore different key functionalities of the HTML to PDF feature.

Blazor Convert Html To Pdf image

Convert HTML to PDF in C#

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

Blazor Partial Wedge To Pdf image

Partial webpage to PDF

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

Blazor Html Form To Pdf Form image

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.

Blazor Pdf Javascript Execution image

JavaScript execution

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

Blazor Pdf Bookmarks image

Bookmarks

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

Offline conversion in Blazor PDF.

Offline conversion

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

Explore references of HTML to PDF

Discover valuable resources from our blogs and knowledge bases to convert HTML to PDF.

HTML-to-PDF Conversion in C#

Blog

HTML-to-PDF Conversion in C# – A Complete Guide

HTML String to PDF conversion

Document

HTML String to PDF conversion

How to add PDF header and footer while converting HTML to PDF

Knowledge base

How to convert HTML to PDF

Knowledge base

How to convert HTML to PDF in ASP.NET Core Linux

How to convert HTML to PDF using a web API in .NET

Knowledge base

How to convert HTML to PDF using a web API in Blazor

How To Convert HTML To PDF In AWS Lambda

Knowledge base

How To Convert HTML To PDF In AWS Lambda

Syncfusion Blazor PDF Library Resources

Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.

Frequently Asked Questions

HTML to PDF conversion is the process of transforming a web page coded in HTML (Hypertext Markup Language) into a PDF (Portable Document Format) file.

Yes, with Syncfusion Blazor HTML to PDF converter, you can convert HTML forms to PDF forms.

Converting HTML to PDF preserves the web page’s layout, formatting, and content for easier sharing, printing, or archiving purposes.

Yes, the Syncfusion HTML to PDF conversion library can be integrated into your applications or used locally without an internet connection.

Our Customers Love Us

Having an excellent set of tools and a great support team, Syncfusion® reduces customers’ development time.
Here are some of their experiences.

Rated by users across the globe

Want to create, view, and edit PDF files in C# or VB.NET?

Start a free 30-day evaluation today!
DOWNLOAD FREE TRIAL

No credit card required.

Mobile Free Evaluation Section

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