ZingPDF.FromHTML
1.0.59
dotnet add package ZingPDF.FromHTML --version 1.0.59
NuGet\Install-Package ZingPDF.FromHTML -Version 1.0.59
<PackageReference Include="ZingPDF.FromHTML" Version="1.0.59" />
<PackageVersion Include="ZingPDF.FromHTML" Version="1.0.59" />
<PackageReference Include="ZingPDF.FromHTML" />
paket add ZingPDF.FromHTML --version 1.0.59
#r "nuget: ZingPDF.FromHTML, 1.0.59"
#:package ZingPDF.FromHTML@1.0.59
#addin nuget:?package=ZingPDF.FromHTML&version=1.0.59
#tool nuget:?package=ZingPDF.FromHTML&version=1.0.59
ZingPDF.FromHTML
ZingPDF.FromHTML provides HTML-to-PDF conversion helpers for ZingPDF using PuppeteerSharp.
Installation
dotnet add package ZingPDF.FromHTML
Reuse an installed browser
Set ZINGPDF_BROWSER_PATH to an installed browser executable. The example receives cancellationToken from the application.
using ZingPDF.FromHTML;
await using var renderer = new HtmlToPdfRenderer(new HtmlToPdfOptions
{
BrowserExecutablePath = Environment.GetEnvironmentVariable("ZINGPDF_BROWSER_PATH")
?? throw new InvalidOperationException("Set ZINGPDF_BROWSER_PATH to an installed browser."),
MaxConcurrency = 4,
RenderTimeout = TimeSpan.FromSeconds(30)
});
await using var pdfStream = await renderer.RenderAsync("""
<!doctype html>
<html>
<head><style>@page { size: A4; margin: 15mm; }</style></head>
<body><h1>Invoice INV-1001</h1></body>
</html>
""", cancellationToken);
await using var output = File.Create("invoice.pdf");
await pdfStream.CopyToAsync(output, cancellationToken);
For any absolute URL supported by Chromium, including HTTP, HTTPS, file, data and about URLs, call renderer.RenderAsync(uri, navigationOptions, cancellationToken). NavigationOptions sets URL wait states and its navigation timeout (zero disables that timeout); a finite renderer deadline still covers the entire conversion.
Browser and print settings
- Supply
BrowserExecutablePathfor an installed Chromium-compatible browser.AllowBrowserDownloaddefaults tofalse; enable it explicitly only if runtime downloading is intended. - Reuse one
HtmlToPdfRendereracross jobs. It owns one browser and creates an isolated browser context for each conversion.MaxConcurrencydefaults to 4; additional jobs queue. RenderTimeoutdefaults to 30 seconds and covers queueing, browser startup, page loading, font readiness and PDF printing. Set it toTimeout.InfiniteTimeSpanto disable the overall deadline.BrowserStartupTimeoutindependently limits browser provisioning and launch to 30 seconds by default and must remain finite. Expiry throwsTimeoutException; caller cancellation throwsOperationCanceledException. Context creation and cleanup must complete to release resources; browser startup or downloading can remain renderer-owned after a caller stops waiting, within the separate startup budget. Disposal cancels browser provisioning. The deadline is not an OS-enforced hard worker bound.- The renderer snapshots options, including print options and launch arguments, at construction. The caller disposes the renderer and returned streams; templates and their converter adapter do not own the renderer.
- New renderer defaults use print media, background printing and CSS page sizes. Set
PdfOptionsfor paper, margins, page ranges or headers/footers. Original staticConverter.ToPdfAsync(...)overloads retain automatic browser downloading, screen media and default PuppeteerSharp print settings. They disable the overall conversion deadline so explicit navigation timeouts, including zero, remain effective; the independent browser startup budget still defaults to 30 seconds. The overload takingHtmlToPdfOptionsuses explicit settings for one job. Offline = trueemulates offline page networking. Embed fonts and images as data URLs. This setting is not an OS-level network sandbox or a security guarantee.- HTML and scripts must be trusted. Isolated browser contexts separate job state; they do not sandbox hostile code at the process or network boundary. The renderer does not disable Chromium's sandbox by default.
Invoice pagination example
examples/GenerateInvoices contains a Liquid invoice template and a Linux container recipe. It exercises 0, 1, 40 and 500 line items, repeated table headers, row preservation, totals and embedded fonts. Browser packages, fonts and OS libraries must be installed during deployment. Validate the recipe in the target Linux image.
Licensing
ZingPDF is proprietary software. Review LICENSE.txt and ensure you have paid license coverage with sufficient seats, or another applicable commercial agreement, before commercial use or commercial bundling. Versions released during a paid subscription remain licensed within the purchased scope after it ends; new versions and support require an active subscription.
Evaluation and other non-commercial use are free.
Support and compatibility
See SUPPORT.md in the package root or docs/project/SUPPORT.md in the repository for the current support stance and release-readiness notes.
More information
- core docs: zingpdf.dev/docs.html
- guides: zingpdf.dev/guides.html
- HTML conversion guide: zingpdf.dev/convert-html-to-pdf-csharp.html
- capability matrix: zingpdf.dev/capabilities.html
- repository: github.com/ZingPDF/ZingPDF
| Product | Versions 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 was computed. 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 was computed. 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. |
-
net8.0
- PuppeteerSharp (>= 20.2.2)
- ZingPDF (>= 1.0.59)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ZingPDF.FromHTML:
| Package | Downloads |
|---|---|
|
ZingPDF.Templates.LiquidHtml
Liquid HTML template rendering for ZingPDF using Fluid and ZingPDF.FromHTML. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.59 | 102 | 10/11/2026 |
| 1.0.58 | 175 | 5/28/2026 |
| 1.0.57 | 141 | 5/25/2026 |
| 1.0.56 | 144 | 5/15/2026 |
| 1.0.54 | 141 | 4/19/2026 |
| 1.0.53 | 125 | 4/19/2026 |
| 1.0.51 | 123 | 4/19/2026 |
| 1.0.49 | 128 | 4/9/2026 |
| 1.0.48 | 125 | 4/7/2026 |
| 1.0.45 | 133 | 4/6/2026 |
| 1.0.44 | 128 | 4/6/2026 |
| 1.0.43 | 131 | 4/6/2026 |
| 1.0.40 | 122 | 4/5/2026 |
| 1.0.38 | 123 | 4/5/2026 |
| 1.0.37 | 118 | 4/5/2026 |
| 1.0.36 | 123 | 4/5/2026 |
| 1.0.35 | 129 | 4/4/2026 |
| 1.0.34 | 128 | 4/4/2026 |
| 1.0.33 | 127 | 4/4/2026 |
| 1.0.32 | 122 | 4/3/2026 |