HiQPdf Chromium for .NET offers you a modern, simple, fast, flexible and powerful tool to create complex and stylish PDF documents in .NET applications for Windows with just a few lines of C# code using the integrated HTML to PDF Converter component.
The HTML to PDF converter uses Chromium as rendering engine which can render all the modern HTML, CSS and JavaScript in conformance with the latest standards and technologies.
HiQPdf Chromium for .NET can run natively on Windows 64-bit operating systems. The product runtime is compatible with Windows 10, Windows Server 2016 and the later versions of the Windows 64-bit OS.
The .NET library is built for .NET Standard 2.0 which makes compatible with a wide range of .NET Core and .NET Framework versions starting with .NET Core 2.0 and .NET Framework 4.6.2 and going upwards to the latest versions available.
The product can run on Windows without installing anything and without any prior configuration of the operating system. The steps necessary to use the library in your own application are detailed below.
The software is also fully compatible with Azure App Service and Azure Functions on Windows and the installation instructions for these platforms can be found in a separate documentation section.
Create a new .NET project in Visual Studio and use the NuGet Package Manager from Visual Studio to add a reference to the HiQPdf.Chromium.Windows package from NuGet.
After the NuGet package has been installed, at the top of your C# source file add the using HiQPdf.Chromium; statement to include the HiQPdf.Chromium namespace in your application code and to make the library API available to your application.
// Include the HiQPdf namespace at the top of your C# file
using HiQPdf;
You are now ready to use the library to convert web pages and HTML code to PDF or to Image using HiQPdf Chromium HTML to PDF Converter.
With the code below you can convert a HTML string to a PDF document in a memory buffer and then save the data from buffer into a file.
// Create the HTML to PDF converter object
HtmlToPdf converter = new HtmlToPdf();
// Convert the HTML code to memory
byte[] htmlToPdfData = converter.ConvertHtmlToMemory("<b>Hello World</b> from HiQPdf !", null);
// Save the PDF data to a file
System.IO.File.WriteAllBytes("html_to_memory.pdf", htmlToPdfData);
With the code below you can convert an URL to a PDF document in a memory buffer and then save the data from buffer into a file. The URL can also be a local file path prefixed by the 'file://' URI scheme.
// Create the HTML to PDF converter object
HtmlToPdf converter = new HtmlToPdf();
// Convert the HTML page from URL to memory
string urlToConvert = "http://www.hiqpdf.com";
byte[] urlToPdfData = converter.ConvertUrlToMemory(urlToConvert);
// Save the PDF data to a file
System.IO.File.WriteAllBytes("url_to_memory.pdf", urlToPdfData);
With the code below you can convert in your ASP.NET Core applications a HTML string to a PDF document in a memory buffer and then send it for download to browser.
// Create the HTML to PDF converter object
HtmlToPdf converter = new HtmlToPdf();
// Convert the HTML code to memory
byte[] htmlToPdfData = converter.ConvertHtmlToMemory("<b>Hello World</b> from HiQPdf !", null);
FileResult fileResult = new FileContentResult(htmlToPdfData, "application/pdf");
fileResult.FileDownloadName = "html_to_pdf.pdf";
return fileResult;
With the code below you can convert in your ASP.NET Core applications an URL to a PDF document in a memory buffer and then send it for download to browser. The URL can also be a local file path prefixed by the 'file://' URI scheme.
// Create the HTML to PDF converter object
HtmlToPdf converter = new HtmlToPdf();
// Convert the HTML code to memory
string urlToConvert = "http://www.hiqpdf.com";
byte[] urlToPdfData = converter.ConvertUrlToMemory(urlToConvert);
FileResult fileResult = new FileContentResult(urlToPdfData, "application/pdf");
fileResult.FileDownloadName = "url_to_pdf.pdf";
return fileResult;
Everything should have been configured at this point and now you can run your application. Alternatively, you can follow the same instructions from this document to build and publish on Windows our demo application for ASP.NET.