Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →For modern, JavaScript-heavy pages, start with a Chromium-based renderer. IronPDF offers the shortest high-level C# path; PuppeteerSharp gives you MIT-licensed, direct Chromium control; and Playwright .NET is sensible when browser automation is already part of your stack. Choose iText pdfHTML when parser-based conversion, PDF post-processing, or a documented PDF/UA workflow matters. Do not select PDFsharp alone for HTML conversion: it has no HTML rendering engine.
Which C# HTML-to-PDF library should you choose?
The right choice depends less on a feature checklist than on how your HTML is produced and what the resulting PDF must guarantee.
| Library | Rendering approach | JavaScript | Best fit | Main trade-off | License or obligation |
|---|---|---|---|---|---|
| IronPDF | Chromium-based renderer | Yes, through browser rendering | Commercial applications that want a concise C# API and browser-like output | Commercial licensing and browser-runtime deployment | Commercial component; verify current terms |
| PuppeteerSharp | .NET control of Chrome/Chromium | Yes | Teams prioritizing MIT licensing and direct browser control | You package, download, update and operate Chromium | MIT package license |
| iText pdfHTML | Parser-based HTML/CSS conversion in iText | Not a general browser JavaScript runtime | Projects already using iText, PDF manipulation, or a documented PDF/UA path | CSS/HTML behavior differs from a browser; licensing review is essential | AGPL or commercial licensing, depending on use |
| Playwright .NET | Browser automation for Chromium, Firefox and WebKit | Yes | Applications that already standardize on Playwright automation | Validate the PDF API and runtime model for your exact release | Review the project’s current terms |
| PDFsharp | PDF creation and editing primitives | No HTML renderer | Programmatic PDF drawing or post-processing after another renderer | Requires a separate HTML-to-PDF engine | Review the edition and license you deploy |
| wkhtmltopdf wrappers | External WebKit-based executable | Limited compared with current Chromium pages | Existing systems tied to that executable | Native executable deployment and older web-platform behavior | Review the wrapper and executable licenses |
There is no neutral benchmark that establishes a universal winner for speed, memory or pixel accuracy. Measure your own templates, fonts, images, page counts and concurrency before committing.
How to evaluate an HTML-to-PDF library
Rendering fidelity
Chromium-based tools execute the same broad HTML, CSS and JavaScript model used by a current browser. They are usually the safest starting point for client-rendered applications, web fonts, flexbox, grid, canvas and lazy-loaded images. Parser-based converters can be more deterministic and lighter, but you must test every CSS construct your templates use.
#1 Best Overall
JavaScript and page readiness
A URL is not necessarily ready when its initial response arrives. Single-page applications may need a selector, a delay, or network-idle detection before printing. Browser automation libraries expose these controls directly. A parser-based converter is preferable when the input is already complete HTML and you deliberately do not want JavaScript execution.
Pagination and print CSS
Check support for @page, margins, page breaks, repeating headers, footers, paper sizes and landscape output. Test long tables, images that cross page boundaries, widows and orphans, and content whose height changes after fonts or scripts load.
Deployment and concurrency
Browser renderers need a browser binary, sandbox settings, fonts and enough memory for concurrent pages. Decide whether to launch one browser and reuse it, how many pages may print at once, and how crashed workers are replaced. Container images must include the fonts and native libraries your documents require. Parser-based conversion avoids a browser process but can require more template-specific CSS work.
Compliance and post-processing
If you need PDF/UA or another accessibility target, choose a workflow that documents that path and validate the generated files with your own accessibility tooling. iText’s pdfHTML documentation specifically covers HTML/CSS conversion and a PDF/UA route. Browser print output may still require tagging, metadata or remediation after rendering.
IronPDF: the shortest high-level C# route
IronPDF documents a Chromium renderer and C# methods for HTML strings, URLs and HTML pages. It also exposes options such as custom headers and footers and a SaveAs operation. This is a strong choice when browser-grade rendering is more important than avoiding a commercial dependency.
Install and render an HTML string
dotnet add package IronPdf
using IronPdf;
var renderer = new ChromePdfRenderer();
var html = "<html><body><h1>Invoice</h1><p>Paid</p></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("invoice.pdf");
The same renderer can convert a URL or an HTML page. For authenticated pages, prefer an explicit session or a controlled HTML input rather than embedding credentials in a URL. Confirm the library’s current API and runtime requirements for the version you install.
Rank #2
When IronPDF is the practical choice
- You want a supported commercial component instead of maintaining browser download and update logic.
- Your templates rely on modern CSS or JavaScript and you want Chromium-like output.
- You value a compact API for HTML, URLs, headers, footers and saving files.
Account for the commercial license in procurement, and test the browser runtime in every target environment, including Linux containers and restricted sandboxes.
PuppeteerSharp: direct Chromium control with C#
PuppeteerSharp is a .NET port of the official Node.js Puppeteer API. Its examples cover setting page content, navigating to a URL, waiting for selectors and calling PdfAsync. The NuGet package is MIT licensed, while the Chromium binary remains an operational dependency.
Minimal runnable example
dotnet add package PuppeteerSharp
using PuppeteerSharp;
await new BrowserFetcher().DownloadAsync();
await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true
});
await using var page = await browser.NewPageAsync();
await page.SetContentAsync("<html><body><h1>Report</h1></body></html>");
await page.PdfAsync("report.pdf", new PdfOptions
{
Format = PaperFormat.A4,
PrintBackground = true,
PreferCSSPageSize = true
});
Make dynamic pages deterministic
await page.GoToAsync("https://example.com/report", WaitUntilNavigation.Networkidle0);
await page.WaitForSelectorAsync("#report-ready");
await page.PdfAsync("report.pdf", new PdfOptions
{
PrintBackground = true,
DisplayHeaderFooter = true,
HeaderTemplate = "<span></span>",
FooterTemplate = "<span class='pageNumber'></span> / <span class='totalPages'></span>"
});
Pin a known browser revision, install required fonts, and run a bounded number of pages per worker. If a page never reaches network idle because of analytics or streaming requests, wait for a business-specific selector or use a controlled delay instead.
iText pdfHTML: parser-based conversion and PDF workflows
iText describes pdfHTML as an add-on for iText Core that converts HTML/XML and CSS to PDF in Java and C#. It is attractive when the same codebase also needs PDF manipulation, metadata, signing or other iText capabilities.
Basic C# shape
dotnet add package itext7
dotnet add package itext7.pdfhtml
using iText.Html2pdf;
using iText.Kernel.Pdf;
using var writer = new PdfWriter("document.pdf");
using var pdf = new PdfDocument(writer);
HtmlConverter.ConvertToPdf(
"<html><body><h1>Statement</h1></body></html>",
pdf);
Use a base URI or resource resolver when the HTML references relative CSS, images or fonts, and explicitly test unsupported browser-only behavior. Commercial or closed-source use requires a commercial iText license and the appropriate license-key library; AGPL obligations may apply in other distributions. Have counsel review the exact deployment model.
Choose pdfHTML when
- Your project already depends on iText Core.
- You need extensive PDF manipulation after conversion.
- A documented PDF/UA workflow is more important than executing arbitrary page JavaScript.
Playwright .NET: useful when browser automation is already standardized
Microsoft’s Playwright .NET project is the official .NET port for automating Chromium, Firefox and WebKit through one API. It can be a good fit if your test, scraping or workflow stack already uses Playwright.
Recommended Free Tools
dotnet add package Microsoft.Playwright
playwright install
using Microsoft.Playwright;
using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions
{
Headless = true
});
var page = await browser.NewPageAsync();
await page.GotoAsync("https://example.com", new PageGotoOptions
{
WaitUntil = WaitUntilState.NetworkIdle
});
await page.PdfAsync(new PagePdfOptions
{
Path = "page.pdf",
Format = "A4",
PrintBackground = true
});
Verify the exact PDF-printing API, browser support and installation command for the Playwright release you select. PDF output is commonly associated with Chromium, so do not assume identical PDF behavior across all three browser engines.
Why PDFsharp and wkhtmltopdf are different choices
PDFsharp is not an HTML renderer
PDFsharp creates and edits PDF objects; it does not parse a web page and lay out HTML by itself. Pair it with a separate renderer, or use it after conversion for drawing, merging and other PDF edits. Calling PDFsharp a complete HTML-to-PDF solution leads to a deployment that cannot render the input.
wkhtmltopdf requires an external executable
Wrappers around wkhtmltopdf launch a native executable. That means shipping the binary, handling process timeouts, securing command arguments and keeping the executable available on every host. Its older WebKit engine may not match modern CSS or JavaScript behavior, so test existing templates before selecting it for a new project.
A repeatable implementation checklist
- Classify the input. Decide whether it is static HTML, a server-rendered page, or a client-rendered application.
- Define the contract. Record page size, margins, orientation, headers, footers, links, fonts, accessibility target and maximum document length.
- Make readiness explicit. Wait for a selector or application signal instead of relying only on a fixed sleep.
- Control resources. Bundle fonts, set navigation and PDF timeouts, limit concurrent pages and cap input size.
- Test pagination. Include long tables, missing images, very long words, empty data sets, right-to-left text and pages with slow JavaScript.
- Validate output. Check that the PDF opens, has the expected page count, includes text and links, and meets any accessibility requirement.
- Observe failures. Log the library version, browser revision, URL or template identifier, elapsed time, page count and exception category without logging secrets.
Performance, reliability and cost considerations
- Reuse browser processes carefully. Reusing one browser reduces startup work, but recycle it after crashes or suspected leaks.
- Limit concurrency experimentally. More simultaneous pages can increase throughput until CPU, memory, fonts or network bandwidth become the bottleneck.
- Cache immutable assets. Local CSS, fonts and images reduce conversion variability; never cache personalized content across users.
- Set separate timeouts. Navigation, selector readiness, JavaScript execution and PDF writing can fail for different reasons.
- Budget licensing and operations. Commercial libraries have license costs; open-source browser approaches shift cost into packaging, patching, monitoring and infrastructure.
- Benchmark your workload. Use representative templates and measure p50/p95 duration, memory at target concurrency, failure rate and output validation results. No published neutral figure should be treated as your capacity plan.
Common failures and fixes
The PDF is blank
Cause: JavaScript has not finished, the wrong frame is selected, or the page failed before rendering. Fix: wait for a stable selector, inspect console and network errors, confirm the URL responds in the same environment, and capture a diagnostic screenshot or HTML snapshot.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →CSS or fonts are missing
Cause: relative URLs lack a base path, outbound requests are blocked, or the font is not installed. Fix: provide a base URI or absolute asset URLs, allow required resources, bundle fonts, and wait for document.fonts.ready before printing.
Pages break in the wrong places
Cause: print CSS is incomplete or content height changes after layout. Fix: define @page, use print-specific break rules, set the intended paper size, and print only after images and fonts have loaded.
Rank #4
Navigation or PDF generation times out
Cause: streaming requests prevent network idle, a third-party resource is slow, or the document is unusually large. Fix: wait for an application selector, block nonessential requests, set bounded per-stage timeouts, and split very large jobs.
It works locally but fails in a container
Cause: missing browser libraries, sandbox permissions, fonts or executable paths. Fix: install the documented runtime dependencies, include fonts in the image, use the browser path reported by your package, and apply sandbox changes only according to your hosting security model.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallLicensing blocks release
Cause: AGPL or commercial terms were evaluated after implementation. Fix: review the exact application distribution with counsel before production; for iText, commercial or closed-source use requires the commercial license described in its .NET guidance.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If your requirement is a faithful PDF or image capture of a public web page rather than a server-side HTML template, ScreenshotNeo is the first alternative to try: it removes common consent banners, popups and chat widgets before capture, and only clean results are billed.
One GET request can return PNG, JPEG, WebP or PDF. The API supports full-page capture with lazy images, CSS-element capture, device and viewport settings, retina scale, print options, custom CSS and JavaScript, clicks, selector or network-idle waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification. Its parameter names are compatible with those used by many screenshot APIs.
For developers using AI tools, ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients.
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o page.pdf
Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com"}, timeout=90)
r.raise_for_status()
open("page.pdf", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('page.pdf', Buffer.from(await res.arrayBuffer()));
See the ScreenshotNeo API documentation for output and option details. Failed loads, bot checks or CAPTCHAs, blank pages, timeouts and cache hits are not billed, and response headers identify the page verdict and billing status. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to try it.
Best Value
FAQ
Can I convert an authenticated page?
Yes, browser-based libraries can establish an authenticated context, and tools with header or cookie controls can send session data. Keep credentials out of URLs and logs, and verify that sensitive data is not cached or exposed in generated files.
Is JavaScript execution always desirable?
No. Execute it when the page is genuinely client-rendered; disable or avoid it for deterministic, static templates where a parser-based converter is easier to secure and operate.
Should I generate PDFs in a web request?
Short documents may fit a request/response path. For large pages, slow assets or bursts of traffic, queue a background job and return a status identifier so browser work cannot exhaust web-server threads.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
How do I prove a converter is suitable?
Build a fixture set from real templates and test visual output, extracted text, links, page count, accessibility checks, failure recovery and resource usage at the concurrency you expect.
Frequently Asked Questions
Can a C# converter create PDFs from HTML stored in a database?
Yes. Load the trusted HTML string and pass it to the library’s HTML-input method; provide a controlled base URI for referenced CSS, images and fonts.
Which option is best for a mostly static invoice template?
A parser-based library such as iText pdfHTML can be appropriate when the template does not need browser JavaScript; choose a Chromium route when browser fidelity is more important.
Does PDFsharp replace an HTML-to-PDF library?
No. PDFsharp creates and edits PDF content but does not provide an HTML rendering engine.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsQuick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

