HiQPdf Chromium for .NET offers a modern, simple, fast, flexible and powerful tool for creating 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 its rendering engine, capable of rendering all modern HTML, CSS and JavaScript in full compliance with the latest web standards and technologies.
The library is much more than just an HTML to PDF converter. It can also automatically generate a PDF document outline with bookmarks, set security permissions, protect documents with passwords, and digitally sign the generated PDF files.
The .NET library is built for .NET Standard 2.0, which makes it 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 up to the latest available versions.
HiQPdf Chromium for .NET is compatible with Windows and Linux 64-bit operating systems. There is a separate package for each platform, including the same .NET library but using different native Chromium runtimes for Windows and Linux.
The converter runs with full functionality in Azure App Service and Azure Functions .NET Core applications targeting both Windows and Linux platforms.
It is also compatible with Docker containers running on Windows or Linux, with example Dockerfiles provided in dedicated sections of the documentation.
The documentation offers more details about compatibility and installation instructions for each supported platform.
The product is distributed as NuGet packages you can reference from NuGet.org. There are separate NuGet packages for Windows and Linux. The package for Windows is HiQPdf.Chromium.Windows and the package for Linux is HiQPdf.Chromium.Linux.
After referencing the NuGet package, you can add the using HiQPdf.Chromium; directive at the top of your C# source file to make the HiQPdf Chromium API available in your application code.
// Include the HiQPdf namespace at the top of your C# file
using HiQPdf.Chromium;
You can use the C# code below to convert an HTML string to a PDF file, first obtaining the generated PDF in 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 web page from a given URL to a PDF file, first obtaining the generated PDF in a memory buffer. To convert a local file, prefix the full file path with file:// to form 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 provides detailed instructions for getting started with HiQPdf Chromium for .NET on various platforms such as Windows and Linux machines, Azure App Service and Azure Functions or Docker containers for both Windows and Linux.