EggPdf 1.6.1
See the version list below for details.
dotnet add package EggPdf --version 1.6.1
NuGet\Install-Package EggPdf -Version 1.6.1
<PackageReference Include="EggPdf" Version="1.6.1" />
<PackageVersion Include="EggPdf" Version="1.6.1" />
<PackageReference Include="EggPdf" />
paket add EggPdf --version 1.6.1
#r "nuget: EggPdf, 1.6.1"
#:package EggPdf@1.6.1
#addin nuget:?package=EggPdf&version=1.6.1
#tool nuget:?package=EggPdf&version=1.6.1
EggPdf
Pure C# HTML/CSS to PDF rendering engine. Zero dependencies. Chrome-quality output.
Write normal HTML and CSS. Get a perfect PDF. No WebKit, no Chromium, no native binaries.
Why EggPdf?
| Feature | EggPdf | SelectPdf | wkhtmltopdf | Puppeteer |
|---|---|---|---|---|
| Pure C# | Yes | No | No | No |
| Dependencies | Zero | ~50MB WebKit | ~40MB Qt | ~300MB Chrome |
| .NET Framework | 4.6.2+ | Limited | N/A | N/A |
| .NET Core/5+ | All | Some | N/A | Yes |
| CSS Flexbox | Yes | Yes | No | Yes |
| CSS Grid | Yes | Yes | No | Yes |
| SVG Support | Yes (vector) | Yes | Partial | Yes |
| PDF/A | Yes | No | No | No |
| PDF/UA | Yes | No | No | No |
| Tagged PDF | Yes | No | No | No |
| Digital Signatures | Yes | No | No | No |
| License | MIT | Commercial | LGPL | Apache 2 |
Quick Start
dotnet add package EggPdf
// One-liner
byte[] pdf = await EggPdf.HtmlToPdf.RenderAsync("<h1>Hello World</h1>");
File.WriteAllBytes("output.pdf", pdf);
Standard Usage
Page size, margins, and orientation are set with regular CSS @page rules in the HTML itself:
string html = @"
<html><head><style>@page { size: A4; margin: 20mm 15mm; }</style></head>
<body><h1>My Document</h1></body></html>";
// To byte[]
byte[] pdf = await EggPdf.HtmlToPdf.RenderAsync(html);
// To a file
await EggPdf.HtmlToPdf.RenderToFileAsync(html, "report.pdf");
// To a stream (e.g. an HTTP response body), with cancellation
await EggPdf.HtmlToPdf.RenderAsync(html, Response.Body, HttpContext.RequestAborted);
Prefer C# properties over writing CSS? PdfRenderOptions is translated into the equivalent
@page rule internally — it's not a separate layout path, just a convenience wrapper:
byte[] pdf = await EggPdf.HtmlToPdf.RenderAsync(html, new EggPdf.PdfRenderOptions
{
PageSize = "Letter",
Orientation = "landscape",
MarginTop = 40, MarginBottom = 40, // CSS pixels
Title = "Q4 Report", // PDF document metadata
});
ASP.NET Core Integration
dotnet add package EggPdf.AspNetCore
// Plain HTML -> PDF download, no DI registration needed
[HttpGet("report/pdf")]
public IActionResult GetReport()
=> new PdfResult("<h1>Report</h1>", "report.pdf");
// Render a .cshtml Razor view directly -> PDF download, one line.
// Requires services.AddEggPdfRazor() at startup (EggPdf.AspNetCore already
// references EggPdf.Razor, so installing just this package is enough).
[HttpGet("invoice/{id}/pdf")]
public async Task<IActionResult> GetInvoice(int id)
{
var model = await _invoiceService.GetAsync(id);
return new RazorPdfResult("Invoice", model, $"invoice-{id}.pdf");
}
Razor Templates
dotnet add package EggPdf.Razor
services.AddEggPdfRazor();
// Render .cshtml template directly to PDF
public class InvoiceService(IRazorToPdfConverter pdf)
{
public async Task<byte[]> Generate(InvoiceModel model)
=> await pdf.RenderViewAsync("Invoice", model);
}
Features
HTML & CSS
- Full HTML5 parsing (WHATWG spec-compliant)
- CSS 2.1 complete + CSS3 (Flexbox with auto margins & baseline alignment, Grid, Multi-column)
- CSS Custom Properties (
var()) @media printsupport- Webfonts: remote
<link>stylesheets (Google Fonts) and@font-faceover http(s), data: URIs, or files - SVG rendering (vector output, not rasterized)
- All image formats (JPEG, PNG incl. 1-bit QR codes, GIF, WebP, SVG, Base64)
- Cloudflare email obfuscation (
data-cfemail) decoded automatically
- PDF 1.4 / 1.5 / 1.7 / 2.0
- Clickable hyperlinks and internal links
- Auto-generated bookmarks from headings
- Table of contents with page numbers
- Running headers/footers
- Page numbers (Page X of Y)
- Tables spanning any number of pages without row loss
- Mixed page orientations (portrait + landscape)
- Watermarks
- Pin content (e.g. a signature/acceptance box) to the bottom of whichever page dynamic content ends on (
-eggpdf-pin-bottom: page)
Typography
- TrueType/OpenType font embedding with subsetting
- Weight-accurate faces:
font-weight: 300–900each select their own variant - Font fallback chain + per-codepoint symbol-font fallback (⚠ ✔ …)
- Full Unicode: Vietnamese and extended Latin out of the box
- Browser-parity metrics: text measured with the real font, baselines like Chrome
- Automatic hyphenation
Business
- Digital signatures — one-call X.509 signing (
PdfSigner.Sign(pdf, cert), detached CMS/PKCS#7) or external-CMS two-step flow for HSMs - Password protection with permission flags — view-only PDFs that block editing/copying (RC4 40/128-bit)
- AcroForm fields (fillable forms from HTML form elements)
- PDF merging
- QR codes and barcodes
Performance
- Streaming output (constant memory for large documents)
- Font caching across renders
- Thread-safe converter (one instance per app)
- Streaming table layout for 10,000+ row tables
| Scenario | Mean | Memory |
|---|---|---|
| Simple page (h1 + p) | 13 µs | 20 KB |
| Invoice (table + styles) | 86 µs | 85 KB |
| Large table (100 rows) | 1.2 ms | 939 KB |
Benchmarks run on every PR (results posted as comment) and on every merge to main (artifacts uploaded). Targets: simple < 50ms, invoice < 100ms, large table < 5s.
Target Frameworks
| Target | Coverage |
|---|---|
netstandard2.0 |
.NET Framework 4.6.2+, .NET Core 2.0+, Mono, Xamarin, Unity |
netstandard2.1 |
.NET Core 3.0+ |
net6.0 |
.NET 6+ |
net8.0 |
.NET 8+ |
net9.0 |
.NET 9+ |
net10.0 |
.NET 10+ |
Use EggPdf Your Way
NuGet (for .NET developers)
| Package | Description | Dependencies |
|---|---|---|
| EggPdf | Core library | None |
| EggPdf.Razor | Razor template integration | ASP.NET Core |
| EggPdf.AspNetCore | ASP.NET Core middleware | ASP.NET Core |
Docker (for any language / DevOps)
# REST API service (with Web UI)
docker run -p 8080:8080 eggspot/eggpdf:latest
# Open http://localhost:8080 for Web UI, or call REST API from any language
# CLI (convert files)
docker run -v $(pwd):/work eggspot/eggpdf:latest eggpdf /work/input.html -o /work/output.pdf
CLI Binary (standalone, no .NET needed)
Download a single executable for your platform -- no installation required:
| Platform | Download |
|---|---|
| Windows x64 | eggpdf-win-x64.exe |
| Windows ARM64 | eggpdf-win-arm64.exe |
| Linux x64 | eggpdf-linux-x64 |
| Linux ARM64 | eggpdf-linux-arm64 |
| macOS x64 (Intel) | eggpdf-osx-x64 |
| macOS ARM64 (Apple Silicon) | eggpdf-osx-arm64 |
./eggpdf input.html -o output.pdf
./eggpdf https://example.com -o page.pdf # fetch and render a URL
echo "<h1>Hi</h1>" | ./eggpdf - -o output.pdf
Web UI (for anyone)
Open http://localhost:8080 after starting the Docker service. Paste HTML, get PDF. No coding required.
Documentation
See the Wiki for full documentation:
- Getting Started
- Configuration
- Page Layout & CSS
- Headers, Footers & Page Numbers
- Images & SVG
- Tables
- Fonts & Typography
- PDF Features
- Performance
- API Reference
Contributing
Contributions are welcome! We follow strict TDD — write the test before the code:
- Fork the repository
- Create a feature branch:
git checkout -b feat/my-feature - Write the failing test first — run it, confirm it fails
- Write minimal code to make the test pass
- Run the test — if it fails, fix code and run again; repeat until it passes
- Run ALL tests — fix any regressions and repeat until the full suite passes
- Check performance if touching hot paths
- Commit with conventional prefixes:
feat:,fix:,perf:,test: - Push and create a PR
See CLAUDE.md for detailed development guidelines.
Sponsoring
EggPdf is free and open source. If you find it useful, please consider sponsoring:
Your sponsorship helps us:
- Maintain and improve the library
- Add new CSS features and PDF capabilities
- Keep the documentation up to date
- Respond to issues and PRs
License
MIT License. See LICENSE for details.
Copyright (c) 2025 Eggspot
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net6.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on EggPdf:
| Package | Downloads |
|---|---|
|
EggPdf.Razor
Razor template to PDF rendering for EggPdf |
|
|
EggPdf.AspNetCore
ASP.NET Core integration for EggPdf (PdfResult, middleware) |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.9.0 | 32 | 9/24/2026 |
| 1.8.0 | 50 | 9/23/2026 |
| 1.7.0 | 109 | 9/22/2026 |
| 1.6.3 | 173 | 9/17/2026 |
| 1.6.2 | 138 | 9/16/2026 |
| 1.6.1 | 128 | 9/16/2026 |
| 1.6.0 | 133 | 9/16/2026 |
| 1.5.4 | 137 | 9/16/2026 |
| 1.5.3 | 131 | 9/15/2026 |
| 1.5.2 | 138 | 9/15/2026 |
| 1.5.1 | 126 | 9/15/2026 |
| 1.5.0 | 127 | 9/15/2026 |
| 1.4.14 | 125 | 9/15/2026 |
| 1.4.13 | 129 | 9/15/2026 |
| 1.4.12 | 92 | 9/15/2026 |
| 1.4.11 | 92 | 9/15/2026 |
| 1.4.10 | 124 | 9/15/2026 |
| 1.4.9 | 383 | 7/18/2026 |
| 1.4.8 | 129 | 7/18/2026 |
| 1.4.7 | 123 | 7/18/2026 |