GotenbergSharpApiClient
.NET C# client for Gotenberg — a Docker-powered stateless API for converting & merging HTML, Markdown, and Office documents to PDF.
Features
- HTML/URL to PDF — Convert HTML content or URLs to PDF using Chromium
- Screenshots — Capture screenshots of HTML or URLs as PNG, JPEG, or WebP
- Office to PDF — Convert Word, Excel, PowerPoint (100+ formats) via LibreOffice
- PDF Manipulation — Merge, flatten, rotate, split, encrypt, watermark, stamp
- PDF/A & PDF/UA — Archive-ready and accessible PDF output
- Metadata — Read and write PDF metadata
- Webhooks — Async PDF generation with callback support
- DI-Ready — Built for dependency injection with Polly retry policies
Quick Start
Install
Configure
services.AddOptions<GotenbergSharpClientOptions>()
.Bind(Configuration.GetSection("GotenbergSharpClient"));
services.AddGotenbergSharpClient();
Use
var builder = new HtmlRequestBuilder()
.AddDocument(doc => doc.SetBody("<html><body><h1>Hello PDF!</h1></body></html>"))
.WithPageProperties(pp => pp.UseChromeDefaults());
var result = await sharpClient.HtmlToPdfAsync(builder);
See the Getting Started guide for full setup instructions.