Releases: raroche/NetPdf
Release list
NetPdf 1.0.0
NetPdf 1.0.0 — the first stable release. A pure C# / .NET 10 HTML+CSS-to-PDF rendering engine (Apache-2.0). HtmlPdf.Convert(html) runs the full HTML → CSS → layout → paginate → paint → PDF pipeline end-to-end, producing deterministic PDF bytes with no browser, no subprocess, and no revenue-capped or copyleft dependencies.
Install
dotnet add package NetPdf --version 1.0.0- NuGet: https://www.nuget.org/packages/NetPdf/1.0.0
- Docs: https://raroche.github.io/NetPdf/
- Changelog: https://github.com/raroche/NetPdf/blob/v1.0.0/CHANGELOG.md
Supported platforms
.NET 10 on Linux, macOS, and Windows (x64 and arm64). Native-AOT compatible and trimmable. HarfBuzz + Skia native assets are restored automatically — no browser, no subprocess, no manual native install.
Linux slim containers must install
fontconfig(Skia's raster fallback links it). See the README.
Highlights
- Layout & pagination — block, inline, flex (L1), grid (L1), table, multi-column, absolute/fixed positioning; fragmentainer-aware pagination with a break cost model (
break-*,widows,orphans);<thead>/<tfoot>repeat across pages. - Paged media —
@pagesize/margins + all 16 margin boxes; running headers/footers viaposition: fixed/running()+element()/string(); page numbers viacounter(page). - Text — OpenType shaping (HarfBuzz), bidi (UAX #9), line breaking (UAX #14, incl. CJK), grapheme segmentation (UAX #29);
@font-face(TTF/OTF/WOFF/WOFF2) + subsetting; bundled English hyphenation (other languages viaNetPdf.Languages.*). - Visual parity — backgrounds, borders,
border-radius, gradients (linear/radial/conic), box & text shadows, 2D transforms, opacity,clip-path, masks, blend modes; CSS filters via a raster fallback; static SVG; JPEG/PNG/WebP/AVIF/GIF images with content-hash dedup. - Documents & navigation — internal
#idlinks →/GoTo, external links →/URI; heading outline (bookmarks);/Info+ XMP/Metadata+ catalog/Lang. - CSS — cascade,
var(),calc()/min()/max()/clamp()/abs()/sign();::before/::after/::marker/::first-line/::first-letter.
Engine guarantees
- Deterministic — identical input → identical bytes; no timestamp is read unless you set one.
- Native-AOT compatible, with a JIT/AOT byte-parity gate.
- No process spawning at render time.
- Unsupported features emit a stable structured diagnostic code rather than throwing or silently dropping content.
Security
Hardened against the known HTML-to-PDF attack classes (SSRF, local-file read, resource bombs, decoder bugs, PDF active content). SecurityPolicy presets (UntrustedHtml / SafeDefault / TrustedTemplate) with per-render resource budgets. Report vulnerabilities privately via the repository's Security tab — see SECURITY.md.
Known caveats
- Depends on
AngleSharp.Css 1.0.0-beta.*(no stable 1.x exists yet);dotnet packemits NU5104 as a visible warning (not hidden) so the pre-release dependency stays auditable. To be revisited when AngleSharp.Css ships a stable 1.x. - Tailwind via CDN does not render (it needs runtime JS to generate utility CSS) — pre-compile Tailwind to static CSS.