The HTML-to-PDF converter is a .NET 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, Blazor, ASP.NET MVC, ASP.NET Core with Windows, Linux, and MacOS.
The .NET HTML-to-PDF converter allows converting an HTML file, HTML string, URL, ASPX, Razor, or MVC View to PDF with just a few lines of code.
//Initialize HTML to PDF converter. HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(); //Convert URL to PDF document. PdfDocument document = htmlConverter.Convert("https://www.syncfusion.com"); //Create the filestream 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);
'Initialize HTML to PDF converter. Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter() 'Convert URL to PDF document. Dim document As PdfDocument = htmlConverter.Convert("https://www.syncfusion.com") 'Create the filestream to save the PDF document. Dim fileStream As FileStream = New FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite) 'Save and close the PDF document. document.Save(fileStream) document.Close(True)
The Syncfusion HTML-to-PDF converter library in combination with ASP.NET Core offers a simple and straightforward approach for dynamically generating PDF reports from HTML templates.
The PDF will look just like the converted webpage. It preserves all graphics, images, text, fonts, links, and layout of the original HTML document or webpage.
The .NET HTML-to-PDF converter allows users to convert URLs, HTML5, CSS, CSS3, and HTML to PDF with just five lines of C# code.
A part of a webpage can be converted to PDF based on the HTML tag ID.
Convert HTML to PDF with the available offline data by ignoring the online resources.
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.
Hyperlinks can be toggled when converting HTML to PDF documents.
Bookmarks are created automatically in a PDF document based on the HTML heading tags from <h1> to <h6>.
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. Also, apply custom styles to the table of contents.
Windows-authenticated webpages can be converted to PDF with a username and password in the converter.
Form-authenticated webpages can be converted to PDF by using cookies in the converter settings.
Webpages with token-based authentication can be converted to PDF by using bearer tokens in the converter’s HTTP request header.
The .NET HTML-to-PDF converter supports both screen and print media types in conversion using C#.
Convert HTML to PDF based on the desired viewport size.
System and manual proxy settings are available to convert HTML to PDF using C#.
SVG files or SVG elements in HTML can also be converted to PDF document.
Render the whole HTML content into a single PDF page.
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.