|
|
|
|
|
|
EvoPdf Next HTML to PDF Converter for .NET is a core component of the EvoPdf Next Library for .NET, using an advanced,
highly accurate and reliable Chromium-based rendering engine that processes modern HTML, CSS and JavaScript content in
compliance with the latest standards.
The converter targets .NET Standard 2.0 and can be used in .NET Core and .NET Framework applications that you can deploy
on Windows and Linux platforms, including Azure App Service and Functions or Docker.
The main functionality of the component is to convert HTML to PDF, HTML to image and SVG to PDF, but it offers much more.
You can automatically generate a PDF document outline and table of contents, set permissions, password-protect or digitally sign
the generated PDF document.
|
|
|
|
|
|
|
 |
|
Main Features |
|
|
Convert HTML with CSS, Web Fonts and JavaScript to PDF
Support modern web standards and technologies
Add page numbering in PDF headers and footers from HTML
Repeat HTML table headers and footers in PDF pages
Control PDF page breaks with CSS in HTML
Create outlines and tables of contents from heading tags
Convert specific HTML regions
Retrieve HTML element positions in the PDF
Create tagged PDFs for accessibility
|
|
Trigger conversion automatically or manually
Render for screen or print media types
Set PDF security, viewer settings and signatures
Set HTTP headers and cookies
Use GET and POST requests
Convert HTML to JPEG, PNG and WEBP images
Convert SVG to PDF
Asynchronous methods that can be used with async and await
|
|
|
 |
|
Compatibility |
|
|
Windows 10, 11 and Windows Server 2016 to 2025
Linux 64-bit distributions
.NET 10.0, 9.0, 8.0, 7.0, 6.0, .NET Standard 2.0
.NET Framework 4.6.2 to 4.8.1
|
|
Azure App Service and Azure Functions
Azure Cloud Services and Virtual Machines
Web, console and desktop applications
Docker containers for Windows and Linux
|
|
|
 |
|
Getting Started |
|
|
|
You can quickly get started with the ASP.NET demo application available for download, or you can integrate the library into your own project.
The online documentation,
contains detailed instructions on how to run an application using EvoPdf Next Library for .NET on Windows and Linux machines, Azure App Service
and Azure Functions for Windows and Linux.
You can view the current capabilities of the library by checking the
online demo
application and the API reference in the online documentation.
|
|
|
|
Download Demo Application
|
|
|
|
The ZIP package available for download from the link below includes an ASP.NET demo application project with complete C# source code covering all major library features.
|
|
|
|
|
|
Running the samples in the demo application that involve HTML to PDF conversion features on Linux platforms might require installing some dependency packages. The documentation includes an entire section dedicated to building, publishing and running the demo application on multiple platforms.
|
|
 |
|
NuGet Packages |
|
|
|
For Windows deployments add a reference to the
EvoPdf.Next.HtmlToPdf.Windows
NuGet Package and for Linux deployments add a reference to the
EvoPdf.Next.HtmlToPdf.Linux
NuGet Package.
The package for Windows is referenced by the
EvoPdf.Next.Windows
metapackage for all components and the package for Linux is referenced by the
EvoPdf.Next.Linux
metapackage for all components.
There are also multiplatform metapackages that reference both the Windows and Linux HTML to PDF packages:
EvoPdf.Next.HtmlToPdf
for the HTML to PDF functionality and
EvoPdf.Next
for the entire EvoPdf Next library.
|
|
 |
|
Installation |
|
|
|
The HTML to PDF Converter component uses a platform specific runtime.
On Windows platforms, the runtime generally does not require the installation of additional dependencies.
On Linux platforms installing some dependency packages might be necessary, depending on the exact version of Linux you are using.
In online documentation in
the Getting Started and Publish guides you can find instructions about Linux dependencies installation on a variety of Linux platforms.
The other components of the EvoPdf Next library don’t generally require the installation of additional dependencies.
|
|
 |
|
EvoPdf.Next Namespace |
|
|
|
All components of the EvoPdf Next for .NET library share the same
EvoPdf.Next
namespace and can be used together in the same application.
To use the library in your own code, add the using directive at the top of your C# source file, as shown below.
|
|
// add this using statement at the top of your C# file
using EvoPdf.Next;
|
|
 |
|
C# Code Samples |
|
|
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;
|
|