EvoPdf Chromium HTML to PDF for .NET
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. It can be used in .NET applications targeting .NET Standard, .NET Core and .NET Framework on Windows, Linux and Azure platforms.
The HTML to PDF converter component of the library uses a rendering engine based on Chromium, which can render all cutting-edge, modern HTML, CSS and JavaScript content in conformance with the latest standards and technologies currently available.
|
|
|
|
|
EvoPdf Chromium HTML to PDF
|
for .NET |
|
|
|
EvoPdf Chromium HTML to PDF for .NET integrates a new rendering engine enabling the conversion of all modern HTML, CSS and JavaScript content in conformance with the latest standards and technologies currently available.
The library can run on various Windows and Linux platforms and is compatible with Azure App Service and Azure Functions for both Windows and Linux.
The product is bundled and distributed as two separate NuGet packages for Windows and Linux including the same .NET Standard 2.0 library and different native runtimes. Targeting .NET Standard 2.0, makes the packages compatible with a large spectrum of .NET Core and .NET Framework versions.
The main functionality of the library is to convert HTML documents to PDF and images. But the library does much more than this. You can automatically generate an outline with bookmarks for the generated PDF document, set permissions, password protect or digitally sign the generated PDF document.
|
|
|
|
|
|
|
|
|
Compatibility |
|
|
EvoPdf Chromium for .NET is compatible with Windows and Linux 64-bit platforms supporting .NET Standard 2.0, including:
- Windows 10, Windows Server 2016 64-bit and above
- Linux 64-bit Distributions
- .NET Core 8.0, 7.0, 6.0, 5.0, .NET Standard 2.0
- .NET Framework 4.6.2 to 4.8.1
- Azure App Service and Azure Functions
- Azure Windows Cloud Services and Virtual Machines
- Web, Console and Desktop applications
|
|
|
|
NuGet Packages for Windows and Linux |
|
|
EvoPdf Chromium for .NET binaries are bundled and distributed in NuGet packages and there are separate NuGet packages for Windows and Linux platforms.
They include the same .NET Standard 2.0 library, but different native runtimes.
The NuGet package for Windows is EvoPdf.Chromium.Windows
and the NuGet package for Linux is EvoPdf.Chromium.Linux.
The demo application for ASP.NET you can download from the section below references these packages.
|
|
|
|
ASP.NET C# Demo Application |
|
|
The ZIP package you can download from the link below includes a Visual Studio project for the ASP.NET Core demo application with C# sample code for all major library features.
The two folders for Windows and Linux include the same application, the only difference is the NuGet package referenced by each of them.
|
|
|
|
On Windows, you can run the demo application from this package without any special setup.
On Linux, before running the demo application, you should first follow the steps from
online documentation
to setup the Linux machine.
|
|
|
|
Getting Started |
|
|
You can quickly start with the ASP.NET demo application available for download, or you can integrate the library in your own project.
In the online documentation
you can find detailed instructions about running an application using EvoPdf Chromium Library for .NET on Windows and Linux machines, in Azure App Service and Azure Functions for Windows and Linux.
In general, the application deployment on Windows platforms does not require any setup while deployment on Linux platforms requires the additional configuration described in documentation.
|
|
|
|
C# Code Samples |
|
At the top of your C# source file add the using EvoPdf.Chromium; statement to make available the EvoPdf Chromium API for your .NET application.
|
|
// add this using statement at the top of your C# file
using EvoPdf.Chromium;
|
|
To convert a HTML string to a PDF document in a memory buffer and then save the data from buffer into a file you can use the C# code below.
|
|
// 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);
|
|
To convert an URL to a PDF document in a memory buffer and then save the data from buffer into a file you can use the C# code below.
|
|
// 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);
|
|
To convert in your ASP.NET Core application a HTML string or an URL to a PDF document in a memory buffer and then send it for download to browser you can use the C# code below.
|
|
// 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);
FileResult fileResult = new FileContentResult(htmlToPdfBuffer, "application/pdf");
fileResult.FileDownloadName = "HtmlToPdf.pdf";
return fileResult;
|
|