2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
The Syncfusion HTML to PDF converter is a .NET library for converting webpages, SVG, MHTML, and HTML to PDF using C#. It is reliable and accurate. The result preserves all graphics, images, texts, fonts, and the layout of the original HTML document or webpage. Using this library, you can convert a HTML to PDF in C# and VB.NET. Converting HTML to PDF using Blink rendering engine using C# and VB.NET. This tutorial explains how to convert the HTML to PDF by using Blink rendering engine in a simple C# console application. In addition, Syncfusion HTML to PDF converter will work seamlessly in various platforms like WinForms, WPF, ASP.NET, ASP.NET MVC, and Azure Cloud service. Steps to convert HTML to PDF using Blink rendering engine using C# and VB.NET:
C# using Syncfusion.HtmlConverter; using Syncfusion.Pdf;
VB.NET Imports Syncfusion.HtmlConverter Imports Syncfusion.Pdf
C# //Initialize HTML to PDF converter HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink); BlinkConverterSettings settings = new BlinkConverterSettings(); //Assign Blink settings to HTML converter htmlConverter.ConverterSettings = settings; //Convert HTML to PDF PdfDocument document = htmlConverter.Convert("http://www.google.com/"); //Save and Close the PDF document document.Save("HTMLToPDF.pdf"); document.Close(true); //This will open the PDF file so, the result will be seen in default PDF viewer System.Diagnostics.Process.Start("HTMLToPDF.pdf"); VB.NET 'Initialize HTML to PDF converter Dim htmlConverter As HtmlToPdfConverter = New HtmlToPdfConverter(HtmlRenderingEngine.Blink) Dim settings As BlinkConverterSettings = New BlinkConverterSettings() 'Assign Blink settings to HTML converter htmlConverter.ConverterSettings = settings 'Convert URL to PDF Dim document As PdfDocument = htmlConverter.Convert("http://www.google.com/") 'Save and Close the PDF document document.Save("HTMLToPDF.pdf") document.Close(True) 'This will open the PDF file so, the result will be seen in default PDF viewer System.Diagnostics.Process.Start("HTMLToPDF.pdf") You can download the working C#.NET sample from HTMLToPDF_Blink.Zip. You can download the working VB.NET sample from HTMLToPDF_BlinkVB.Zip. By executing the program, you will get the PDF document as follows. Take a moment to peruse the documentation, where you will find other options like HTML string to PDF, HTML to Image, HTML to single PDF page, and HTML to PDF conversion using WebKit Rendering with code examples. Click here to explore the rich set of Syncfusion Essential PDF features. To test the accuracy of HTML to PDF conversion in .NET using C#, try Syncfusion online demo. |
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.