Open source · MIT · C# and .NET 8, 9 and 10

HTML to PDF in under a millisecond.

PdfPecker turns HTML and Markdown into PDFs, and PDFs into images, from plain .NET. No browser to start, no native binaries to ship, no third-party packages. Just one small DLL.

dotnet add package PdfPecker
0.92 msfor a one-page invoice
1,132documents a second on 4 cores
90 MBpeak memory under load
0dependencies beyond .NET

Three lines to your first PDF

Every method is static and thread-safe, so you can convert many documents at once. Write the HTML the way you already do, with modern CSS, and get a PDF back as bytes, a stream or a file. The C# guide walks through invoices, headers and footers and ASP.NET Core.

  • Runs wherever .NET 8 or later runs: Windows, Linux, macOS, x64 and ARM64, containers and serverless
  • Pure managed code: a 5.0 MB DLL instead of a 600 MB browser
  • Never touches the network or your files unless you allow it
Program.cs
using PdfPecker;

byte[] pdf = HtmlToPdf.Convert("<h1>Hello</h1><p>World</p>");
File.WriteAllBytes("hello.pdf", pdf);

// Or straight from ASP.NET Core
app.MapGet("/invoice", () =>
    Results.File(HtmlToPdf.Convert(html), "application/pdf", "invoice.pdf"));

Everything a business document needs

Built for invoices, payslips, reports, tickets and statements: the templates you control.

Modern CSS

Flexbox, grid and subgrid, multi-column layout, var(), calc(), transforms, conic and other gradients, rounded corners, shadows, opacity, filters, blend modes, clip-path, masks, backdrop-filter, text wrapping round float shapes, drop caps, balanced headings, vertical text, border-image, container queries, :has(), nesting, @layer, @supports and modern and relative colours.

Markdown or C# code

CommonMark 0.31 with GitHub tables, task lists, strikethrough and footnotes, plus definition lists and front matter. Or build documents in C# with PdfPecker.Fluent, in the style of QuestPDF.

Real fonts

TrueType, OpenType, WOFF and WOFF2, subset and embedded, with kerning, ligatures, variable fonts, tabular figures, full Unicode and automatic hyphenation in eleven languages.

Proper paging

Page margin boxes and running headers with page numbers, its own margins for the first page, mirrored left and right pages, named pages, footnotes, tables of contents with page numbers, repeated table headers, orphans, widows and break control.

Right-to-left and complex scripts

Arabic and Hebrew with full shaping, set with dir or direction, including right-to-left tables, flex and grid. Devanagari and eight more Indic scripts, Thai and Lao are shaped too. Chinese, Japanese and Korean break into lines by the kinsoku rules.

Images, SVG and barcodes

PNG, JPEG, GIF, WebP, BMP and TIFF, and SVG drawn as crisp vectors with gradients, masks, patterns, embedded images and every SVG filter, inline or from files. QR codes, EPC payment QR codes, Code 128 and EAN-13 are drawn for you, and scans and photos go straight into a PDF.

PDF/A and passwords

Archival PDF/A-2, 3 and 4, AES-256 encryption, permissions, and text, image or SVG watermarks.

Digital signatures

PAdES signatures with your certificate or a key in an HSM or cloud key vault, visible signature boxes and trusted timestamps, or signed into the empty signature field of your template. Verify signed PDFs and keep them verifiable for years.

E-invoices

Factur-X, ZUGFeRD, XRechnung and Peppol XML built from your invoice data, with the totals and VAT calculated and checked against the EN 16931 standard of EU Directive 2014/55/EU, and a ready-made invoice layout in English, German or Danish. Invoice XML is embedded in a valid PDF/A-3 or read back out of the e-invoices you receive, and your PDF attached to Peppol and OIOUBL invoices.

Merge PDFs

Combine any PDFs, streamed one at a time, with links, bookmarks and form fields kept, and tagged files staying accessible. Or add them as they arrive.

Edit existing PDFs

Take out, reorder, rotate and split pages, stamp a PDF or put letterhead under it, make it smaller, add or remove a password, attach files, and extract the text, on any PDF.

Fillable forms

Inputs, check boxes, radio buttons, selects and text areas become PDF form fields people can fill in, and the forms of existing PDFs can be filled and flattened from code.

Accessible PDFs

Tagged PDF, PDF/UA-1 and PDF/UA-2 built from your HTML, so screen readers follow headings, tables, lists and images.

PDF to image and HTML

Its own renderer turns any PDF page into a PNG, JPEG or WebP image (or HTML straight into images), a whole PDF into one multi-page TIFF for fax and archives, or any PDF into one HTML page with selectable, searchable text and working links, with no Ghostscript or native code.

Links and bookmarks

Clickable links, jumps inside the document, and bookmarks from your headings.

Safe by default

No JavaScript, no network, no file access unless allowed, page limits and cancellation for untrusted input.

Fast. Really fast.

Documents a second with one conversion per core on a 4-core cloud VM, on a 5-page document.

ConverterEngineTo deployInvoice, 1 pageReport, 30 pagesPeak memoryMemory
PdfPeckerown, managed5.1 MB DLL0.92 ms33 ms92 MB
HtmlRenderer.PdfSharpown, managed (CSS 2)5.0 MB of DLLs4.9 ms360 ms255 MB
wkhtmltopdfQt WebKit, nativeabout 90 MB282 ms600 ms165 MB
PuppeteerSharpChromiumabout 600 MB106 ms496 ms813 MB
PlaywrightChromiumbrowser + 135 MB131 ms517 ms1,027 MB

Medians after warm-up, Linux, .NET 10. Chromium runs JavaScript and is the reference for CSS; PdfPecker does not run scripts. How it was measured · Compare features

A tour of the API

// Markdown to PDF, styled like a GitHub README
byte[] pdf = MarkdownToPdf.Convert(File.ReadAllText("README.md"));

// Markdown to HTML: a body fragment, or a complete page with the stylesheet
string fragment = MarkdownToHtml.Convert("# Hello\n\n*World*");
string page = MarkdownToHtml.ConvertDocument(markdown);

Made for templates you control

PdfPecker is a document engine, not a web browser. That is what makes it fast and small.

Great for

  • Invoices, payslips and receipts
  • Reports and statements
  • Tickets, labels and letters
  • Docs and READMEs from Markdown

Not for

  • Pages that need JavaScript to render
  • Screenshots of live websites
  • Fetching images from the web on its own
  • Khmer, Myanmar and a few other scripts that need shaping (yet)

Peck your first PDF.

dotnet add package PdfPecker