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.19 — 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, 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, and TIFF decode in-process. Lossless images embed without recompression, CMYK stays CMYK, and an image used twice is stored once.
Effects that stay vector
filter, all sixteen mix-blend-mode values, SVG filters, clip-path, border-image, and background-clip: text are written as native PDF content, not baked into bitmaps.
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.
HTML & CSS
Hand PeachPDF an HTML string and get a vector PDF back. Your templates stay plain HTML you can preview in any browser and hand to anyone who knows the web.
Declarative C# API
Prefer code? PdfGenerator.CreateDocument builds pages, tables, lists, and running headers fluently from C# — on the same layout engine, with no HTML or CSS strings.
Command line
The peachpdf tool is a single native executable — no .NET runtime needed. Convert files, URLs, MHTML, or stdin, and merge several inputs into one PDF.
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 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, 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.
12,597 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.
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.