HiQPdf Chromium for .NET offers you a modern, simple, fast, flexible and powerful tool to create complex and stylish PDF documents in .NET applications 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.
The library is much more than just a HTML to PDF converter. It can also be used to automatically generate the PDF document outline with bookmarks, set the security permissions, password protect and digitally sign the generated PDF document.
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.
HiQPdf Chromium for .NET is compatible with Windows and Linux 64-bit operating systems and there is a separate package for each of these platforms including the same .NET library but having different native Chromium runtimes for Windows and Linux platforms.
The converter can run with all features in your Azure App Service and Azure Functions .NET Core applications targeting both Windows and Linux platforms.
HiQPdf Chromium for .NET is available for Windows and Linux platforms as HiQPdf.Chromium.Windows and HiQPdf.Chromium.Linux packages you can directly reference in your .NET applications.
After the NuGet package was referenced, you ca add at the top of your C# source file the using HiQPdf.Chromium; instruction to make available the HiQPdf Chromium API to your application code.
// Include the HiQPdf namespace at the top of your C# file
using HiQPdf;
You can use the C# code below to convert a HTML string to a PDF file, getting first the generated PDF into a memory buffer.
// 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);
You can use the C# code below to convert a HTML page from a given URL to a PDF file, getting first the generated PDF into a memory buffer. To convert a local file, you can prefix the full file path with file:// to create a valid URL.
// 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);
The documentation includes detailed instructions for using HiQPdf Chromium for .NET on Windows and Linux machines and in Azure App Service and Azure Functions applications for Windows and Linux.