Open source · MIT · .NET 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.86 msfor a one-page invoice
962documents a second on 4 cores
83 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.

  • Runs wherever .NET 10 runs: Windows, Linux, macOS, x64 and ARM64, containers and serverless
  • Pure managed code: a 3.1 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, var(), calc(), transforms, gradients, rounded corners, shadows, opacity and @page.

Markdown

CommonMark 0.31 plus GitHub tables, task lists and strikethrough. Out comes a styled PDF or HTML page.

Real fonts

TrueType, OpenType, WOFF and WOFF2, subset and embedded, with kerning, ligatures and full Unicode.

Proper paging

Running headers and footers with page numbers, repeated table headers, orphans, widows and break control.

Images and SVG

PNG, JPEG, GIF and WebP, and SVG drawn as crisp vectors, inline or from files.

PDF/A and passwords

Archival PDF/A-2b and 3b, AES-256 encryption, permissions and watermarks.

Digital signatures

PAdES signatures with your certificate, visible signature boxes and trusted timestamps.

E-invoices

Factur-X and ZUGFeRD: your invoice XML embedded in a valid PDF/A-3, following the EN 16931 standard of EU Directive 2014/55/EU on e-invoicing.

Merge PDFs

Combine any PDFs, streamed one at a time, with links, bookmarks and form fields kept.

PDF to image

Its own renderer turns any PDF page into a PNG, 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, managed3.1 MB DLL0.86 ms39 ms83 MB
HtmlRenderer.PdfSharpown, managed (CSS 2)2.4 MB of DLLs5.0 ms473 ms255 MB
wkhtmltopdfQt WebKit, nativeabout 90 MB289 ms693 ms164 MB
PuppeteerSharpChromiumabout 600 MB128 ms539 ms849 MB
PlaywrightChromiumbrowser + 135 MB142 ms522 ms986 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

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
  • Right-to-left and complex scripts (yet)

Peck your first PDF.

dotnet add package PdfPecker