Skip to content

PdfNetStack and headless Chromium compared

View as Markdown

Puppeteer Sharp and Playwright for .NET drive a real browser from C#, and a browser can print a page to PDF. PdfNetStack.Html converts HTML and CSS to PDF with a layout engine written in C#, without a browser. It shipped in PdfNetStack 1.1 and is on NuGet.

Puppeteer Sharp. A ”.NET port of the official Node.JS Puppeteer API”. It drives Chrome, and Firefox through WebDriver BiDi. Its examples download a browser with BrowserFetcher, open a page and call page.PdfAsync (repository). Its API documentation notes: “Generating a pdf is currently only supported in Chrome headless” (API). PdfOptions takes header and footer templates with page numbers, and options for a tagged PDF and a document outline (PdfOptions).

Playwright for .NET. A browser automation library from Microsoft. Its NuGet package bundles Node.js runtimes for Windows, Linux and macOS (NuGet, package contents), and playwright.ps1 install downloads Chromium, Firefox and WebKit builds (browsers). Page.PdfAsync “generates a pdf of the page with print css media”. Its options include header and footer templates with page numbers, a tagged PDF and a document outline (API).

Both run the page in a browser engine, so JavaScript runs and layout matches that browser.

PdfNetStack.Html. A layout engine in C# that runs inside your process: the CSS cascade, block, inline, table, flex and grid layout, floats and positioning, paged media with @page, margin boxes, named pages and running headers and footers, repeated table headers, tagged PDF, web fonts, and right to left and Arabic text. Since 1.2, hyphens: auto hyphenates with the patterns of the PdfNetStack.Hyphenation package. No browser to download or keep updated, and nothing is fetched from the network unless you pass a resource loader (HTML to PDF). The result is a PdfDocument that can be signed, encrypted or saved as PDF/A with the rest of PdfNetStack.

  • Puppeteer Sharp. MIT (NuGet).
  • Playwright for .NET. MIT (NuGet). The browsers they download come with their own licenses.
  • PdfNetStack.Html. MIT.

Read each license yourself before you decide. This page is not legal advice.

PdfNetStack.Html 1.2.0Puppeteer Sharp 25.15.0Playwright for .NET 1.64.1
LicenseMITMITMIT
What runsManaged .NET code in your processA downloaded browser; PDF output needs Chrome headlessA bundled Node.js runtime and downloaded browsers
JavaScriptNoYesYes
RenderingC# layout engineThe browser’s engineThe browser’s engine
Network access during conversionNone without a resource loaderAs the browser loads the page; requests can be intercepted and abortedAs the browser loads the page; requests can be routed and aborted
Headers and footers with page numbersCSS margin boxes and running elementsHeaderTemplate and FooterTemplate optionsHeaderTemplate and FooterTemplate options
CSS margin boxes, named pages, running elementsYesAs the browser supports themAs the browser supports them
Bookmarks from headingsYes, on by defaultOutline option, off by defaultOutline option, off by default
Tagged PDFYes, on by defaultTagged option, on by defaultTagged option, off by default
Sign, encrypt, PDF/A on the resultYes, with PdfNetStackNot listedNot listed

Sources: Puppeteer Sharp repository, Puppeteer Sharp Page API, Puppeteer Sharp PdfOptions API and source at 25.15.0 for the defaults, Playwright browsers, Playwright Page API, the NuGet pages linked above. Chrome added page margin boxes for printing and PDF export in version 131 (New in Chrome 131). “Not listed” means the feature is not in the product’s own documentation on the check date.

  • The page needs JavaScript: charts drawn by script, single page applications, content loaded after the page opens. PdfNetStack.Html does not run scripts.
  • You need output that matches what a specific browser shows on screen, including CSS features PdfNetStack.Html does not support yet, such as multi-column layout.
  • You already run browsers for testing and want PDF output from the same setup.
  • You render your own templates, invoices and reports, and want no browser binaries to download, patch and keep in your containers.
  • You convert HTML you do not fully trust and want no network access by default.
  • You want to sign, encrypt or save the result as PDF/A in the same library, or change it as a PdfDocument before saving.

Product names are trademarks of their respective owners, mentioned for reference only, without affiliation or endorsement.

Checked on 2026-11-12.