Getting Started with EvoPdf Next for .NET on Linux

EvoPdf Next for .NET is a library that can be integrated into any type of .NET application to create and process PDF documents.

You can create PDF documents, convert HTML, Word, Excel, RTF and Markdown documents to PDF, extract text and images from existing PDF documents, perform text search operations on PDF documents and convert PDF pages to images.

Compatibility

EvoPdf Next for .NET runs natively on 64-bit Linux operating systems, including both x64 and ARM64 architectures.

The .NET library targets .NET Standard 2.0, so it can be used in any .NET Core or .NET Framework application that supports this standard.

Depending on your Linux distribution and installed system packages, you may need to install additional dependencies for the HTML to PDF Converter component to run properly. The other components of the library do not have additional dependencies.

The software is fully compatible with Azure App Service, Azure Functions and Docker containers on Linux. Separate documentation covers deployment to these platforms.

Install NuGet Package

The library structure is modular, with separate NuGet packages for major components to prevent unnecessary files from being included in your applications. You can choose to reference a single package to install all the components of the library or you can install only the components you need.

Install the Meta-Package for All Components

To install all components of the EvoPdf Next library, add a reference to the EvoPdf.Next.Linux metapackage from NuGet, which targets Linux x64.

For Linux ARM64, reference the EvoPdf.Next.Linux.Arm64 metapackage instead.

The metapackage references the packages for all library components, including the HTML to PDF converter, Word to PDF, Excel to PDF, RTF to PDF and Markdown to PDF conversion components, as well as the PDF text extraction and text search functionalities, the PDF to Image converter and the PDF Images Extractor. This can bring many files into your project and you may prefer to use only specific components.

Install Specific Packages for Components

To install only specific components of the EvoPdf Next library, you can add references to the corresponding NuGet packages from NuGet.

To use only the Core component, you can install the EvoPdf.Next.Core.Linux NuGet package, which supports both Linux x64 and Linux ARM64.

To use only the HTML to PDF Converter component, you can install the EvoPdf.Next.HtmlToPdf.Linux NuGet package for x64, or the EvoPdf.Next.HtmlToPdf.Linux.Arm64 NuGet package for ARM64.

To use the Word to PDF, Excel to PDF, RTF to PDF or Markdown to PDF conversion components on Linux x64, install the corresponding package: EvoPdf.Next.WordToPdf.Linux, EvoPdf.Next.ExcelToPdf.Linux, EvoPdf.Next.RtfToPdf.Linux or EvoPdf.Next.MarkdownToPdf.Linux .

For Linux ARM64, reference the corresponding ARM64 packages instead: EvoPdf.Next.WordToPdf.Linux.Arm64, EvoPdf.Next.ExcelToPdf.Linux.Arm64, EvoPdf.Next.RtfToPdf.Linux.Arm64 or EvoPdf.Next.MarkdownToPdf.Linux.Arm64.

To use the PDF Processor components PDF to Text, PDF Text Search, PDF to Image and PDF Images Extraction, you only need to install the EvoPdf.Next.PdfProcessor.Linux NuGet package for x64, or the EvoPdf.Next.PdfProcessor.Linux.Arm64 NuGet package for ARM64.

Any combination of these packages can be installed in your project, depending on which components you want to use.

Include EvoPdf.Next Namespace

All components of the library share the same EvoPdf.Next namespace and can be used together in the same application.

After the NuGet package has been installed, add the using EvoPdf.Next; directive at the top of your C# source file to include the EvoPdf.Next namespace and make the library API available.

C#
// add this using statement at the top of your C# file
using EvoPdf.Next;

You are now ready to use the EvoPdf Next library API in your .NET application targeting the Linux operating system.

Configure a Linux Machine to Run EvoPdf Next HTML to PDF Converter

The HTML to PDF Converter component for Linux requires installing several system packages. The other components don't require any additional setup.

Install Dependency Packages

Required system packages vary slightly by distribution. Below are examples for the most common ones.

On Ubuntu 20.04, Ubuntu 22.04, Ubuntu 24.04, Ubuntu 25.04 or Debian 12, run:

bash
sudo apt update && sudo apt install -y libnss3 libatk-bridge2.0-0 libcairo2 libpango-1.0-0

On RedHat 9.5 or Amazon Linux 2023, run:

bash
sudo dnf install -y nss at-spi2-atk cairo pango

Set Execution Permissions for HTML to PDF Converter

Before running the HTML to PDF Converter on Linux, ensure that the evopdf_runtimes/linux-x64/native/evopdf_loadhtml file has execution permissions.

If you installed the ARM64 runtime, the information below also applies to the evopdf_runtimes/linux-arm64/native folder.

This file is automatically copied to your application's output directory after the NuGet package is installed and the project is built.

To grant execution permissions to evopdf_loadhtml, run the following command in the application's output directory:

bash
chmod +x evopdf_runtimes/linux-x64/native/evopdf_loadhtml

Set Execution Permissions for PDF Processor

Before running the PDF Processor components PDF to Text, PDF Text Search, PDF to Image and PDF Images Extraction on Linux, ensure that the evopdf_runtimes/linux-x64/native/evopdf_pdfprocessor file has execution permissions.

This file is automatically copied to your application's output directory after the NuGet package is installed and the project is built.

To grant execution permissions to evopdf_pdfprocessor, run the following command in the application's output directory:

bash
chmod +x evopdf_runtimes/linux-x64/native/evopdf_pdfprocessor

Convert an HTML string to PDF

With the code below, you can convert an HTML string to a PDF document in a memory buffer and then save the data from the buffer to a file.

C#
// create the converter object where you want to perform the conversion
HtmlToPdfConverter converter = new HtmlToPdfConverter();

// convert an 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);

Convert a URL to PDF

With the code below, you can convert a URL to a PDF document in a memory buffer and then save the the data from the buffer to a file. The URL can also be a local file path prefixed with the "file://" URI scheme.

C#
// create the converter object where you want to perform the conversion
HtmlToPdfConverter converter = new HtmlToPdfConverter();

// convert a 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);

Convert an HTML string to PDF in ASP.NET

With the code below, you can convert an HTML string to a PDF document in an ASP.NET Core application, store it in a memory buffer and then send it to the browser for download.

C#
// create the converter object where you want to perform the conversion
HtmlToPdfConverter converter = new HtmlToPdfConverter();

// convert an 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;

Convert a URL to PDF in ASP.NET

With the code below, you can convert a URL to a PDF document in an ASP.NET Core application, store it in a memory buffer and then send it to the browser for download. The URL can also be a local file path prefixed with the "file://" URI scheme.

C#
// create the converter object where you want to perform the conversion
HtmlToPdfConverter converter = new HtmlToPdfConverter();

// convert a URL to a memory buffer
string htmlPageURL = "http://www.evopdf.com";
byte[] urlToPdfBuffer = converter.ConvertUrl(htmlPageURL);

FileResult fileResult = new FileContentResult(urlToPdfBuffer, "application/pdf");
fileResult.FileDownloadName = "UrlToPdf.pdf";
return fileResult;

Run Application

At this point, everything should be configured and you can now run your application. Alternatively, you can follow the same instructions in this document to build and publish the ASP.NET demo application on Linux.

See Also