EvoPdf Chromium for .NET is a library that can be easily integrated into any type of .NET application to convert web pages and HTML strings to PDF or to image.
The HTML to PDF converter component of the library uses a rendering engine based on Chromium, which can render all modern HTML, CSS and JavaScript content in conformance with the latest standards.
The converter combines the powerful printer friendly PDF format with the flexibility of the HTML format into a modern tool for creating nicely formatted and easily maintainable PDF reports and documents.
The main functionality of the library is to convert HTML documents to PDF and to images. But the library does much more than this. You can automatically generate an outline with bookmarks for the generated PDF document, you can set the permissions, password protect or digitally sign the generated PDF document.
The library targets the .NET Standard 2.0 and therefore it can be used in any .NET Core or .NET Framework application which is compatible with this standard.
The product can run natively on Windows and Linux 64-bit operating systems. There is a separate package for each of these platforms which includes the specific native runtime libraries besides the common .NET library.
The software is also fully compatible with Azure App Service and Azure Functions platforms from Microsoft, both Windows and Linux. The documentation contains 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 for Linux. The package for Windows platforms is EvoPdf.Chromium.Windows and the package for Linux platforms is EvoPdf.Chromium.Linux.
It takes only one a few lines of code to convert a web page from a given URL or a HTML string to a PDF document:
At the top of your C# source file add the using EvoPdf.Chromium; statement to make available the EvoPdf Chromium HTML to PDF API for your .NET application.
// add this using statement at the top of your C# file
using EvoPdf.Chromium;
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 converter object in your code where you want to run conversion
HtmlToPdfConverter converter = new HtmlToPdfConverter();
// convert a HTML string to a memory buffer
byte[] htmlToPdfBuffer = converter.ConvertHtml("<b>Hello World</b> from EVO PDF !", null);
// write the memory buffer to a PDF file
System.IO.File.WriteAllBytes("HtmlToMemory.pdf", htmlToPdfBuffer);
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 converter object in your code where you want to run conversion
HtmlToPdfConverter converter = new HtmlToPdfConverter();
// convert an URL to a memory buffer
string htmlPageURL = "http://www.evopdf.com";
byte[] urlToPdfBuffer = converter.ConvertUrl(htmlPageURL);
// write the memory buffer to a PDF file
System.IO.File.WriteAllBytes("UrlToMemory.pdf", urlToPdfBuffer);
The documentation sections provide detailed instructions for getting started with EvoPdf Chromium for .NET on various platforms, including Windows and Linux machines, Azure App Service and Azure Functions for Windows and Linux.