PdfPecker 1.9.0

dotnet add package PdfPecker --version 1.9.0
                    
NuGet\Install-Package PdfPecker -Version 1.9.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PdfPecker" Version="1.9.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PdfPecker" Version="1.9.0" />
                    
Directory.Packages.props
<PackageReference Include="PdfPecker" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PdfPecker --version 1.9.0
                    
#r "nuget: PdfPecker, 1.9.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PdfPecker@1.9.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PdfPecker&version=1.9.0
                    
Install as a Cake Addin
#tool nuget:?package=PdfPecker&version=1.9.0
                    
Install as a Cake Tool

PdfPecker

PdfPecker

NuGet

Fast HTML and Markdown to PDF conversion, and PDF to PNG, JPEG and WebP rendering, for .NET, with no dependencies.

PdfPecker has its own HTML parser, Markdown parser, CSS engine, layout engine and PDF writer, and its own PDF renderer. It does not start a browser, ship native binaries or pull in third-party packages; the NuGet package depends only on the .NET base class library.

using PdfPecker;

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

Documentation: pdfpecker.net/docs · HTML to PDF in C#: a step-by-step guide

Install

dotnet add package PdfPecker

The package targets net8.0, net9.0 and net10.0, so it works on .NET 8 and later, on Windows, Linux and macOS.

Quick start

// HTML string to PDF bytes, or file to file (relative images and stylesheets resolve against the HTML file's folder)
byte[] pdf = HtmlToPdf.Convert(html);
HtmlToPdf.ConvertFile("invoice.html", "invoice.pdf");

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

// Page size, margins, footer and fonts
var options = new PdfOptions
{
    PageSize = PageSize.Letter,
    Margins = PageMargins.FromMillimeters(20, 15, 20, 15),
    FooterText = "Page {page} of {pages}",
};
options.Fonts.AddFile("fonts/OpenSans-Regular.ttf");
byte[] letter = HtmlToPdf.Convert(html, options);

// Markdown to PDF, merging, and PDF pages to PNG
byte[] guide = MarkdownToPdf.Convert(File.ReadAllText("README.md"));
byte[] merged = PdfMerger.Merge(invoicePdf, termsPdf);
byte[][] pngs = PdfToImage.Convert(pdf, new ImageOptions { Dpi = 150 });

All methods are static and thread-safe, so you can convert many documents in parallel.

Features

  • HTML and CSS: flexbox, grid, multi-column, floats and positioning, transforms, transparency, gradients, var() and calc(), relative colours, media and container queries, @import, nesting and cascade layers, filter, clip-path, blend modes, border-image, inset shadows, blurred text shadows, aspect-ratio, ::first-letter and ::first-line, @counter-style and list images, inline SVG and SVG files (with embedded images and every SVG filter), PNG, JPEG, GIF, WebP, BMP and TIFF. More
  • Paged media: @page sizes and margin boxes, its own margins for the first page and mirrored left and right pages, content laid out at each page's own width, right-to-left page order, named pages, running headers, footnotes (float: footnote), tables of contents with page numbers, repeated table headers, orphans, widows and break control. More
  • Markdown: CommonMark 0.31 and GitHub Flavored Markdown to PDF or HTML. More
  • Fonts: TrueType, OpenType, WOFF and WOFF2, subset and embedded, with @font-face, kerning, ligatures, variable fonts (font-weight, font-stretch, font-variation-settings) and OpenType features such as tabular figures (font-variant-numeric, font-feature-settings). More
  • Right-to-left, CJK and hyphenation: Arabic and Hebrew with bidi and shaping, Chinese, Japanese and Korean line breaking with kinsoku rules, and hyphens: auto. More
  • PDF/A, passwords and watermarks: PDF/A-2, 3 and 4, AES-256 encryption and permissions, also for existing PDFs; text, image and SVG watermarks. More
  • Accessibility: tagged PDF, PDF/UA-1 and PDF/UA-2 built from your HTML. More
  • Fillable forms: HTML inputs, check boxes, radio buttons, selects and text areas become PDF form fields; read, fill and flatten the fields of existing PDFs. More
  • Digital signatures: PAdES signatures, visible boxes, timestamps, existing signature fields, external signers such as HSMs, smart cards or cloud key vaults, verification of signed PDFs, and long-term validation (DSS with OCSP and CRLs, document timestamps). More
  • E-invoices and attachments: Factur-X and ZUGFeRD, PDFs in Peppol and OIOUBL invoices, and any embedded file. More
  • Existing PDFs: merge (also streamed), extract, reorder, rotate and split pages, stamp or underlay pages, and extract their text with positions. More
  • PDF to image: PdfPecker's own renderer turns any PDF page into PNG, JPEG or WebP. More

PdfPecker is built for HTML templates you control: it runs no JavaScript and never fetches anything from the network on its own. See the limitations for what it does not do yet.

How it compares

The same three documents converted to A4 PDF by PdfPecker and six .NET alternatives, on one 4-core cloud VM (Intel Xeon @ 2.8 GHz, 16 GB, Linux, .NET 10.0.12). Times are medians after a 3-second warm-up; "first PDF" includes starting the browser where there is one. Parallel runs one conversion per core at once on the 5-page document. Peak memory is the proportional set size (PSS) of the whole process tree, so a browser's helper processes are included once and shared pages are not double-counted.

PdfPecker is 60 to 150 times faster than the Chromium-based converters on the small documents and uses a tenth of their memory. How to read the table, how it was measured and how to run it yourself is in Performance.

Converter Engine To deploy First PDF Invoice, 1 page Feature tour, 5 pages Report, 30 pages Parallel Peak memory
PdfPecker own, managed 3.1 MB DLL 0.27 s 0.86 ms 2.7 ms 39 ms 962 docs/s 83 MB
HtmlRenderer.PdfSharp 1.6.1 own, managed (CSS 2) 2.4 MB of DLLs 0.47 s 5.0 ms 16 ms 473 ms 88 docs/s 255 MB
iText pdfHTML 6.3.4 * own, managed 11 MB of DLLs 1.68 s 41 ms 242 ms 4.2 s 8 docs/s 614 MB
wkhtmltopdf 0.12.6 Qt WebKit, native about 90 MB with Qt 0.31 s 289 ms 333 ms 693 ms 12 docs/s 164 MB
PuppeteerSharp 25.13 Chromium 141 about 600 MB browser 0.91 s 128 ms 166 ms 539 ms 12 docs/s 849 MB
Microsoft.Playwright 1.63 Chromium 141 browser + 135 MB driver 1.08 s 142 ms 191 ms 522 ms 11 docs/s 986 MB
Syncfusion HTML to PDF 35.1.40 * Chrome (Blink), bundled about 545 MB with Chrome 2.52 s 263 ms 314 ms 1.7 s 1 doc/s 2,195 MB

* Measured later (October 2026) on the same VM type with the same program. In that run the other converters were up to 70% slower than in the table above and PdfPecker slightly faster, so these two rows are approximate and, if anything, a little slower than a like-for-like run would show.

Building

dotnet build
dotnet test
dotnet run --project samples/PdfPecker.Sample -c Release      # converts samples/PdfPecker.Sample/html/*.html and *.md into ./output
dotnet run --project bench/PdfPecker.Benchmarks -c Release
dotnet run --project bench/PdfPecker.Benchmarks -c Release -- --requirements    # memory and CPU per conversion
dotnet pack src/PdfPecker -c Release -o ./nupkg

License

MIT. The third-party fonts, font data and code built into the library are listed, with their licenses, in THIRD-PARTY-NOTICES.md.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.9.0 28 10/16/2026
1.8.0 73 10/16/2026
1.7.0 84 10/15/2026
1.6.0 56 10/15/2026
1.5.1 58 10/14/2026
1.4.0 49 10/14/2026
1.3.0 43 10/14/2026
1.2.0 66 10/14/2026
1.1.1 45 10/13/2026
1.1.0 86 10/13/2026
1.0.0 75 10/12/2026