Click or drag to resize

HTML to PDF Converter Overview

The HTML to PDF converter of ExpertPdf Anywhere converts web pages, HTML strings and HTML files to PDF documents and to images. It is part of the ExpertPdf.Anywhere library, which runs on .NET 8, .NET 9, .NET 10 and .NET 11 and on every framework that runs .NET Standard 2.0 libraries (.NET Framework 4.6.1 and later), on Windows (x64 and x86), Linux (x64 and ARM64) and macOS (Apple Silicon): ASP.NET Core and ASP.NET applications, console applications, services, desktop applications, containers and cloud functions. No printer driver is used. See Requirements.

The converter renders the HTML with Chromium, the engine of the Chrome browser - HTML5, CSS3, web fonts and JavaScript - and preserves the look of the page in the PDF, with selectable and searchable text, live links and embedded fonts. The engine ships in the NuGet packages, next to the application; it runs inside the application by default, or in a process of its own for each conversion. Report pages of your own application, with their charts, grids and styles, become PDF documents with a few lines of code.

Quick start

Install the platform package of the machine that runs the application, for example ExpertPdf.Anywhere.Windows or ExpertPdf.Anywhere.Linux (see Installation), then:

using ExpertPdf.Anywhere.HtmlToPdf;

PdfConverter converter = new PdfConverter();
converter.LicenseKey = "your license key";

// a web page to a PDF file
converter.SavePdfFromUrlToFile("https://www.example.com", "page.pdf");

// an HTML string to a PDF document in memory (to send it to a browser, store it,
// attach it to an email...)
byte[] pdfBytes = converter.GetPdfBytesFromHtmlString(
    "<h1>Hello</h1><p>From ExpertPdf</p>");

The default settings suit most documents. The converter has many options to control the result: the page size, orientation and margins, headers and footers, page breaks, bookmarks, security, the PDF standard and more - see Getting started and Features.

What the converter does
See Also