{"id":47779946,"url":"https://github.com/eggspot/eggpdf","last_synced_at":"2026-04-18T04:04:10.036Z","repository":{"id":345869993,"uuid":"1187358252","full_name":"eggspot/EggPdf","owner":"eggspot","description":"Pure C# HTML/CSS to PDF rendering engine. Zero dependencies. Chrome-quality output. MIT license.","archived":false,"fork":false,"pushed_at":"2026-04-03T14:32:42.000Z","size":686,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T16:24:17.337Z","etag":null,"topics":["csharp","css","dotnet","html-to-pdf","html5","mit-license","pdf","pdf-generation","rendering-engine","zero-dependency"],"latest_commit_sha":null,"homepage":"https://github.com/eggspot/EggPdf/wiki","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eggspot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["eggspot"]}},"created_at":"2026-03-20T16:26:25.000Z","updated_at":"2026-04-03T14:32:50.000Z","dependencies_parsed_at":"2026-04-07T07:01:04.330Z","dependency_job_id":null,"html_url":"https://github.com/eggspot/EggPdf","commit_stats":null,"previous_names":["eggspot/eggpdf"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/eggspot/EggPdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggspot%2FEggPdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggspot%2FEggPdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggspot%2FEggPdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggspot%2FEggPdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggspot","download_url":"https://codeload.github.com/eggspot/EggPdf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggspot%2FEggPdf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31503394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","css","dotnet","html-to-pdf","html5","mit-license","pdf","pdf-generation","rendering-engine","zero-dependency"],"created_at":"2026-04-03T13:01:26.818Z","updated_at":"2026-04-18T04:04:10.023Z","avatar_url":"https://github.com/eggspot.png","language":"C#","funding_links":["https://github.com/sponsors/eggspot"],"categories":[],"sub_categories":[],"readme":"# EggPdf\n\n[![CI](https://github.com/eggspot/EggPdf/actions/workflows/ci.yml/badge.svg)](https://github.com/eggspot/EggPdf/actions/workflows/ci.yml)\n[![NuGet](https://img.shields.io/nuget/v/EggPdf.svg)](https://www.nuget.org/packages/EggPdf)\n[![NuGet Downloads](https://img.shields.io/nuget/dt/EggPdf.svg)](https://www.nuget.org/packages/EggPdf)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n**Pure C# HTML/CSS to PDF rendering engine.** Zero dependencies. Chrome-quality output.\n\nWrite normal HTML and CSS. Get a perfect PDF. No WebKit, no Chromium, no native binaries.\n\n## Why EggPdf?\n\n| Feature | EggPdf | SelectPdf | wkhtmltopdf | Puppeteer |\n|---------|--------|-----------|-------------|-----------|\n| Pure C# | Yes | No | No | No |\n| Dependencies | **Zero** | ~50MB WebKit | ~40MB Qt | ~300MB Chrome |\n| .NET Framework | 4.6.2+ | Limited | N/A | N/A |\n| .NET Core/5+ | All | Some | N/A | Yes |\n| CSS Flexbox | Yes | Yes | No | Yes |\n| CSS Grid | Yes | Yes | No | Yes |\n| SVG Support | Yes (vector) | Yes | Partial | Yes |\n| PDF/A | Yes | No | No | No |\n| PDF/UA | Yes | No | No | No |\n| Tagged PDF | Yes | No | No | No |\n| Digital Signatures | Yes | No | No | No |\n| License | MIT | Commercial | LGPL | Apache 2 |\n\n## Quick Start\n\n```bash\ndotnet add package EggPdf\n```\n\n```csharp\n// One-liner\nbyte[] pdf = await EggPdf.HtmlToPdf.RenderAsync(\"\u003ch1\u003eHello World\u003c/h1\u003e\");\nFile.WriteAllBytes(\"output.pdf\", pdf);\n```\n\n## Standard Usage\n\n```csharp\nvar converter = new HtmlToPdfConverter(new PdfOptions\n{\n    PageSize = PageSize.A4,\n    Orientation = PageOrientation.Portrait,\n    Margins = new PageMargins(top: 20, right: 15, bottom: 20, left: 15, unit: Unit.Mm),\n    DefaultFont = \"Arial\",\n    Title = \"My Document\"\n});\n\n// To byte[]\nbyte[] pdf = await converter.RenderAsync(htmlString);\n\n// To file\nawait converter.RenderToFileAsync(htmlString, \"report.pdf\");\n\n// To HTTP response (streaming, no buffering)\nawait converter.RenderAsync(htmlString, Response.Body, HttpContext.RequestAborted);\n```\n\n## ASP.NET Core Integration\n\n```bash\ndotnet add package EggPdf.AspNetCore\n```\n\n```csharp\n// DI Registration\nservices.AddEggPdf(options =\u003e\n{\n    options.PageSize = PageSize.A4;\n    options.DefaultFont = \"Arial\";\n});\n\n// Controller\n[HttpGet(\"invoice/{id}/pdf\")]\npublic async Task\u003cIActionResult\u003e GetInvoice(int id)\n{\n    var model = await _invoiceService.GetAsync(id);\n    string html = await _viewRenderer.RenderAsync(\"Invoice\", model);\n    return new PdfResult(html) { FileName = $\"invoice-{id}.pdf\" };\n}\n```\n\n## Razor Templates\n\n```bash\ndotnet add package EggPdf.Razor\n```\n\n```csharp\nservices.AddEggPdfRazor();\n\n// Render .cshtml template directly to PDF\npublic class InvoiceService(IRazorToPdfConverter pdf)\n{\n    public async Task\u003cbyte[]\u003e Generate(InvoiceModel model)\n        =\u003e await pdf.RenderViewAsync(\"Invoice\", model);\n}\n```\n\n## Features\n\n### HTML \u0026 CSS\n- Full HTML5 parsing (WHATWG spec-compliant)\n- CSS 2.1 complete + CSS3 (Flexbox, Grid, Multi-column)\n- CSS Custom Properties (`var()`)\n- `@media print` support\n- `@font-face` with WOFF/WOFF2\n- SVG rendering (vector output, not rasterized)\n- All image formats (JPEG, PNG, GIF, WebP, SVG, Base64)\n\n### PDF\n- PDF 1.4 / 1.5 / 1.7 / 2.0\n- Clickable hyperlinks and internal links\n- Auto-generated bookmarks from headings\n- Table of contents with page numbers\n- Running headers/footers\n- Page numbers (Page X of Y)\n- Repeating table headers across pages\n- Mixed page orientations (portrait + landscape)\n- Watermarks\n\n### Typography\n- TrueType/OpenType font embedding with subsetting\n- Font fallback chain\n- CJK support (Chinese, Japanese, Korean)\n- Vietnamese, Thai, Arabic, Hebrew\n- Emoji rendering (color emoji)\n- Automatic hyphenation\n- Variable font support\n\n### Business\n- PDF/A (archival: 1b, 2b, 3b)\n- PDF/UA (accessibility)\n- Digital signatures (PAdES)\n- AcroForm fields\n- QR codes and barcodes\n- File attachments (ZUGFeRD/Factur-X e-invoicing)\n- PDF merging\n- AES-256 encryption\n\n### Performance\n- Streaming output (constant memory for large documents)\n- Font caching across renders\n- Thread-safe converter (one instance per app)\n- Streaming table layout for 10,000+ row tables\n\n\u003c!-- BENCHMARK_START --\u003e\n| Scenario | Mean | Memory |\n|----------|------|--------|\n| Simple page (h1 + p) | **13 µs** | 20 KB |\n| Invoice (table + styles) | **86 µs** | 85 KB |\n| Large table (100 rows) | **1.2 ms** | 939 KB |\n\n*Benchmarks run on every PR (results posted as comment) and on every merge to `main` (artifacts uploaded). Targets: simple \u003c 50ms, invoice \u003c 100ms, large table \u003c 5s.*\n\u003c!-- BENCHMARK_END --\u003e\n\n## Target Frameworks\n\n| Target | Coverage |\n|--------|----------|\n| `netstandard2.0` | .NET Framework 4.6.2+, .NET Core 2.0+, Mono, Xamarin, Unity |\n| `netstandard2.1` | .NET Core 3.0+ |\n| `net6.0` | .NET 6+ |\n| `net8.0` | .NET 8+ |\n| `net9.0` | .NET 9+ |\n| `net10.0` | .NET 10+ |\n\n## Use EggPdf Your Way\n\n### NuGet (for .NET developers)\n\n| Package | Description | Dependencies |\n|---------|-------------|--------------|\n| [EggPdf](https://www.nuget.org/packages/EggPdf) | Core library | None |\n| [EggPdf.Razor](https://www.nuget.org/packages/EggPdf.Razor) | Razor template integration | ASP.NET Core |\n| [EggPdf.AspNetCore](https://www.nuget.org/packages/EggPdf.AspNetCore) | ASP.NET Core middleware | ASP.NET Core |\n\n### Docker (for any language / DevOps)\n\n```bash\n# REST API service (with Web UI)\ndocker run -p 8080:8080 eggspot/eggpdf:latest\n# Open http://localhost:8080 for Web UI, or call REST API from any language\n\n# CLI (convert files)\ndocker run -v $(pwd):/work eggspot/eggpdf:latest eggpdf /work/input.html -o /work/output.pdf\n```\n\n### CLI Binary (standalone, no .NET needed)\n\nDownload a single executable for your platform -- no installation required:\n\n| Platform | Download |\n|----------|----------|\n| Windows x64 | [eggpdf-win-x64.exe](https://github.com/eggspot/EggPdf/releases/latest) |\n| Windows ARM64 | [eggpdf-win-arm64.exe](https://github.com/eggspot/EggPdf/releases/latest) |\n| Linux x64 | [eggpdf-linux-x64](https://github.com/eggspot/EggPdf/releases/latest) |\n| Linux ARM64 | [eggpdf-linux-arm64](https://github.com/eggspot/EggPdf/releases/latest) |\n| macOS x64 (Intel) | [eggpdf-osx-x64](https://github.com/eggspot/EggPdf/releases/latest) |\n| macOS ARM64 (Apple Silicon) | [eggpdf-osx-arm64](https://github.com/eggspot/EggPdf/releases/latest) |\n\n```bash\n./eggpdf input.html -o output.pdf\n./eggpdf input.html -o output.png --format png\n./eggpdf input.html --watch    # live reload\n./eggpdf --serve               # start REST API server\n```\n\n### Web UI (for anyone)\n\nOpen `http://localhost:8080` after starting the Docker service. Paste HTML, get PDF. No coding required.\n\n## Documentation\n\nSee the [Wiki](https://github.com/eggspot/EggPdf/wiki) for full documentation:\n\n- [Getting Started](https://github.com/eggspot/EggPdf/wiki/Getting-Started)\n- [Configuration](https://github.com/eggspot/EggPdf/wiki/Configuration)\n- [Page Layout \u0026 CSS](https://github.com/eggspot/EggPdf/wiki/Page-Layout)\n- [Headers, Footers \u0026 Page Numbers](https://github.com/eggspot/EggPdf/wiki/Headers-Footers)\n- [Images \u0026 SVG](https://github.com/eggspot/EggPdf/wiki/Images-SVG)\n- [Tables](https://github.com/eggspot/EggPdf/wiki/Tables)\n- [Fonts \u0026 Typography](https://github.com/eggspot/EggPdf/wiki/Fonts-Typography)\n- [PDF Features](https://github.com/eggspot/EggPdf/wiki/PDF-Features)\n- [Performance](https://github.com/eggspot/EggPdf/wiki/Performance)\n- [API Reference](https://github.com/eggspot/EggPdf/wiki/API-Reference)\n\n## Contributing\n\nContributions are welcome! We follow strict TDD — **write the test before the code**:\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feat/my-feature`\n3. **Write the failing test first** — run it, confirm it fails\n4. Write minimal code to make the test pass\n5. **Run the test** — if it fails, fix code and run again; repeat until it passes\n6. **Run ALL tests** — fix any regressions and repeat until the full suite passes\n7. **Check performance** if touching hot paths\n8. Commit with conventional prefixes: `feat:`, `fix:`, `perf:`, `test:`\n9. Push and create a PR\n\nSee [CLAUDE.md](CLAUDE.md) for detailed development guidelines.\n\n## Sponsoring\n\nEggPdf is free and open source. If you find it useful, please consider sponsoring:\n\n[![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-pink?style=for-the-badge)](https://github.com/sponsors/eggspot)\n\nYour sponsorship helps us:\n- Maintain and improve the library\n- Add new CSS features and PDF capabilities\n- Keep the documentation up to date\n- Respond to issues and PRs\n\n## License\n\nMIT License. See [LICENSE](LICENSE) for details.\n\nCopyright (c) 2025 Eggspot\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggspot%2Feggpdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggspot%2Feggpdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggspot%2Feggpdf/lists"}