HTML to PDF.
Pure .NET.

PeachPDF renders HTML, CSS, SVG, and MathML straight to vector PDF — entirely in-process. No headless browsers. No native dependencies. Anywhere .NET runs.

dotnet add package PeachPDF

Current version: v0.9.23 — release notes

Why PeachPDF

Pure .NET, in-process

No Puppeteer, wkhtmltopdf, or Ghostscript to install, babysit, or patch. HTML parsing, CSS cascade, layout, and PDF writing all run inside your process — containers, serverless, trimmed and AOT deployments included.

Native vector SVG and MathML

Inline <svg>, standalone files, data URIs, and CSS image sources render as real vector PDF content — and so do <math> formulas, typeset from the font's own OpenType MATH table. Crisp at any zoom, never rasterized.

Modern CSS layout

Flexbox, Grid with subgrid, multi-column layout, container queries, cascade layers, nesting, @supports, custom properties with var(), calc(), transforms, and gradients with CSS Color Level 4 interpolation.

Print-grade paged media

@page rules, named pages, margin boxes, running headers, footnotes, automatic bookmarks, and CSS-only tables of contents with real page numbers. Mix page sizes and orientations in one PDF.

Standards-grade PDF output

Optional tagged PDF (PDF/UA) with CSS-driven tag mapping, PDF/A parts 1–3 (with file attachments and ZUGFeRD/Factur-X e-invoices), PDF/X-1a/3/4 with CMYK and ICC color management, and PDF 2.0. Metadata flows in automatically from <title> and <meta>.

Text in every script

Web fonts via @font-face, fonts from a stream, and system font discovery, with browser-grade matching. Arabic and Indic shaping, full Unicode bidi, vertical writing modes, OpenType features, and searchable color emoji.

Images done right

JPEG, PNG, GIF, BMP, WebP, AVIF, TIFF, and JPEG XL decode in-process. Lossless images embed without recompression, CMYK stays CMYK, and an image used twice is stored once.

Effects that stay vector

All sixteen mix-blend-mode values, clip-path, border-image, background-clip: text, and most filter functions are written as native PDF content, not baked into bitmaps. The few effects a PDF cannot express — filter: blur() and the cross-channel colour filters, blurred shadows, backdrop-filter, perspective, and SVG filters with blur, lighting or noise — are rendered as a high-resolution bitmap (300 dpi by default) placed at exactly their own size, with their text still selectable. A PDF/A-1 or PDF/X document can ask for transparency to be flattened the same way instead of being rejected.

Fillable forms

Turn <input> and <select> into real AcroForm fields — text, checkbox, radio, and choice — styled with ordinary CSS. One opt-in setting, EnableInteractivePdfForms.

See how PeachPDF compares to other .NET PDF libraries →

Three ways to build a PDF

One layout engine, three front doors — pick the one that fits how your team works.

A few lines to a finished PDF

One package, one generator, one call. Render any HTML string to a vector PDF document and save it wherever a stream goes.

PdfGenerateConfig pdfConfig = new(){
  PageSize = PageSize.Letter,
  PageOrientation = PageOrientation.Portrait
};

PdfGenerator generator = new();

var document = await generator.GeneratePdf(html, pdfConfig);
document.Save(stream);

Runs where you do

Trimmed and Native AOT

The library is trim-safe and AOT-compatible, so it fits self-contained, single-file, and natively compiled deployments.

Standalone binaries

Prebuilt peachpdf executables for Windows and Linux (x64 and ARM64) and Apple Silicon macOS.

In the browser

The whole pipeline runs under WebAssembly. Try the live demo — your document never leaves your machine.

Desktop, server, and mobile

Windows, Linux, macOS, Android, and iOS, on .NET 8 and newer.

Dig into the docs

Why PeachPDF?

How it compares to IronPDF, Puppeteer, wkhtmltopdf, QuestPDF, and friends — and why HTML is the right input format.

Getting Started

Install the package, render your first PDF, and get the thread-safety model right from the start.

Architecture

How HTML becomes a PDF: the parser, DOM, CSS cascade, layout engine, painting layer, and PDF renderer.

HTML & CSS Support

The full compatibility matrix of elements, properties, selectors, at-rules, and MathML — including gaps and extensions.

SVG Features

Everything supported in inline and standalone SVG, rendered as real vector PDF content.

Usage Examples

Copy-pasteable recipes: MHTML, HTTP fetching, fonts, tagged PDF output, ASP.NET Core, and Azure Functions.

Declarative API

Build documents directly from C# — pages, tables, lists, and running headers — with no HTML or CSS strings.

Command-Line Tool

Install the standalone peachpdf executable and convert HTML to PDF from any shell or build script.

How It's Tested

The test suite, the CI matrix, the coverage gate, and how rendering is verified by rasterizing the output.

Feature Showcase

Real PDFs rendered by the current release at build time, side by side with the exact HTML (or, for the declarative API, C#) they came from.

Try It in Your Browser

Drop in an HTML file, an MHTML archive, or a ZIP of a site and get a PDF back — running entirely on your machine.

API Reference

Generated reference for every public type and member of PeachPDF and the PeachDrawing packages, always in sync with the latest source.

Built to be trusted

A PDF can contain exactly the right operators and still look wrong, so PeachPDF is tested on the pixels as well as the bytes.

17,767 automated tests

The parser, cascade, every layout engine, painting, SVG, fonts, and PDF output — run against .NET 8, 10, and 11.

Three operating systems

Every change builds and tests on Windows, Linux, and macOS, where font discovery and text metrics differ most.

A 90% coverage gate

New and changed lines must be covered by tests before a pull request can merge.

Verified by rasterizing

Graphics work is checked by rendering the output with two independent engines — PDFium, Chrome's, and MuPDF — not only by inspecting PDF operators.

PeachDrawing.Text

The font and text engine, with no third-party dependencies: loading and matching fonts, bidirectional text, script itemization, hyphenation and emoji presentation, from a NuGet package of its own.

Read how PeachPDF is tested →

Ready to render?

dotnet add package PeachPDF

Free and open source. Available on NuGet, developed on GitHub.

Need help? Free community and paid support options are available.