Gotenberg.Sharp.API.Client
3.2.1
dotnet add package Gotenberg.Sharp.API.Client --version 3.2.1
NuGet\Install-Package Gotenberg.Sharp.API.Client -Version 3.2.1
<PackageReference Include="Gotenberg.Sharp.API.Client" Version="3.2.1" />
<PackageVersion Include="Gotenberg.Sharp.API.Client" Version="3.2.1" />
<PackageReference Include="Gotenberg.Sharp.API.Client" />
paket add Gotenberg.Sharp.API.Client --version 3.2.1
#r "nuget: Gotenberg.Sharp.API.Client, 3.2.1"
#:package Gotenberg.Sharp.API.Client@3.2.1
#addin nuget:?package=Gotenberg.Sharp.API.Client&version=3.2.1
#tool nuget:?package=Gotenberg.Sharp.API.Client&version=3.2.1
<h1> <img src="https://raw.githubusercontent.com/ChangemakerStudios/GotenbergSharpApiClient/refs/heads/develop/resources/gotenberg-sharp-client.png" width="48" height="48" align="top" /> Gotenberg Sharp API Client </h1>
.NET C# client for Gotenberg v7 & v8 — a Docker-powered stateless API for converting & merging HTML, Markdown, and Office documents to PDF. Includes a configurable Polly retry policy with exponential backoff.
v3.2.1 — More reliable retries, exact A-series paper sizes,
Gotenberg-Traceon API errors, async error handling, and options validation. See CHANGES.MD for details.
Features
- HTML/URL to PDF with Chromium (page properties, headers/footers, cookies, wait conditions)
- Screenshots of HTML or URLs as PNG, JPEG, or WebP
- Office to PDF via LibreOffice (100+ formats, image compression, watermarks)
- PDF Manipulation — merge, flatten, rotate, split, encrypt, watermark, stamp, embed files
- PDF/A & PDF/UA compliance, metadata & bookmark read/write
- Webhooks for async PDF generation
- DI-Ready with Polly retry policies
Quick Start
docker run --rm -p 3000:3000 gotenberg/gotenberg:8
dotnet add package Gotenberg.Sharp.Api.Client
// Startup.cs
services.AddOptions<GotenbergSharpClientOptions>()
.Bind(Configuration.GetSection("GotenbergSharpClient"));
services.AddGotenbergSharpClient();
HTML to PDF
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);
Screenshot
var builder = new ScreenshotHtmlRequestBuilder()
.AddDocument(doc => doc.SetBody("<html><body><h1>Screenshot!</h1></body></html>"))
.WithScreenshotProperties(p => p.SetSize(1280, 720).SetFormat(ScreenshotFormat.Png));
var imageStream = await sharpClient.ScreenshotHtmlAsync(builder);
Office to PDF
var builder = new MergeOfficeBuilder()
.WithAsyncAssets(async a => a.AddItems(await GetDocsAsync(sourceDir)))
.SetLibreOfficeOptions(o => o.SetQuality(85).SetExportBookmarks())
.SetPdfOutputOptions(o => o.SetPdfFormat(PdfFormat.A2b));
var result = await sharpClient.MergeOfficeDocsAsync(builder);
PDF Operations
// Rotate
using var rotated = await sharpClient.ExecutePdfEngineAsync(
PdfEngineBuilders.Rotate(90).WithPdfs(a => a.AddItem("doc.pdf", bytes)));
// Encrypt
using var encrypted = await sharpClient.ExecutePdfEngineAsync(
PdfEngineBuilders.Encrypt("reader123", "admin456").WithPdfs(a => a.AddItem("doc.pdf", bytes)));
// Watermark (inline, on any conversion)
var builder = new HtmlRequestBuilder()
.AddDocument(doc => doc.SetBody(html))
.SetWatermarkOptions(w => w.SetTextWatermark("DRAFT"));
Documentation
See the full documentation for:
- Getting Started — setup, configuration, DI
- HTML & URL to PDF — Chromium features, page properties, cookies
- Screenshots — PNG/JPEG/WebP capture
- Office Conversion — LibreOffice options
- PDF Manipulation — merge, rotate, split, encrypt, watermark, bookmarks, embedded files
- Advanced Features — webhooks, value objects, version compatibility, multi-URL merge
Examples
See the examples folder for complete working console applications.
Release History
See CHANGES.MD for the full release history.
Star History
<a href="https://www.star-history.com/?repos=ChangemakerStudios%2FGotenbergSharpApiClient&type=date&legend=bottom-right"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=ChangemakerStudios/GotenbergSharpApiClient&type=date&theme=dark&legend=bottom-right&sealed_token=z5p1MPnrE9kOQ54LnPGNWeTOnk2_TocK1Lxf9bazC2eWxz6DBwLXsVy3X_SkotQnapS37KEUFLG2cN8eZzTCsbgnDFrssZ8fSXXTZTN7xiCVGAWNjbh0xg" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=ChangemakerStudios/GotenbergSharpApiClient&type=date&legend=bottom-right&sealed_token=z5p1MPnrE9kOQ54LnPGNWeTOnk2_TocK1Lxf9bazC2eWxz6DBwLXsVy3X_SkotQnapS37KEUFLG2cN8eZzTCsbgnDFrssZ8fSXXTZTN7xiCVGAWNjbh0xg" /> <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=ChangemakerStudios/GotenbergSharpApiClient&type=date&legend=bottom-right&sealed_token=z5p1MPnrE9kOQ54LnPGNWeTOnk2_TocK1Lxf9bazC2eWxz6DBwLXsVy3X_SkotQnapS37KEUFLG2cN8eZzTCsbgnDFrssZ8fSXXTZTN7xiCVGAWNjbh0xg" /> </picture> </a>
Support This Project
GotenbergSharpApiClient is free and open source. If it saves you time, consider sponsoring — sponsorships go directly toward the costs of maintaining Changemaker Studios' open-source projects, like code-signing certificates and development tooling.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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
- Microsoft.Bcl.HashCode (>= 1.1.1)
- Microsoft.Extensions.DependencyInjection (>= 2.2.0)
- Microsoft.Extensions.Http (>= 2.2.0)
- Microsoft.Extensions.Http.Polly (>= 2.2.0)
- MimeMapping (>= 3.0.1)
- Newtonsoft.Json (>= 13.0.3)
-
.NETStandard 2.1
- Microsoft.Extensions.DependencyInjection (>= 3.1.5)
- Microsoft.Extensions.Http (>= 3.1.5)
- Microsoft.Extensions.Http.Polly (>= 3.1.5)
- MimeMapping (>= 3.0.1)
- Newtonsoft.Json (>= 13.0.3)
-
net10.0
- Microsoft.Extensions.DependencyInjection (>= 10.0.0)
- Microsoft.Extensions.Http (>= 10.0.0)
- Microsoft.Extensions.Http.Polly (>= 10.0.0)
- MimeMapping (>= 3.0.1)
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.7)
- MimeMapping (>= 3.0.1)
- Newtonsoft.Json (>= 13.0.3)
-
net9.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.0)
- Microsoft.Extensions.Http (>= 9.0.0)
- Microsoft.Extensions.Http.Polly (>= 9.0.0)
- MimeMapping (>= 3.0.1)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Gotenberg.Sharp.API.Client:
| Package | Downloads |
|---|---|
|
SpCraft.Net.Common.Pdf
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.2.1 | 150 | 11/8/2026 |
| 3.1.0 | 93,982 | 8/14/2026 |
| 3.0.0 | 164,474 | 4/6/2026 |
| 2.8.5 | 30,711 | 3/27/2026 |
| 2.8.4 | 325,098 | 10/18/2025 |
| 2.8.3 | 37,575 | 10/6/2025 |
| 2.8.1 | 639 | 10/5/2025 |
| 2.8.0 | 476,895 | 3/25/2025 |
| 2.5.0 | 87,217 | 2/7/2025 |
| 2.4.0 | 334,871 | 8/10/2024 |
| 2.3.0 | 139,269 | 4/17/2024 |
| 2.2.2 | 83,982 | 1/30/2024 |
| 2.1.1 | 359,936 | 10/1/2022 |
| 2.0.2 | 75,400 | 8/30/2022 |
| 2.0.1 | 1,613 | 8/30/2022 |
v3.2.1 - Retry fixes: settings on options subclasses are honoured, only connection failures, 429, 502 and 503 are retried, and non-seekable streams are not resent. GotenbergApiException exposes Trace and reads error bodies asynchronously. A-series paper sizes are exact. Options are validated. Implicit number-to-Dimension conversions are obsolete. See CHANGES.MD for full details.
v3.1.0 - PDF bookmark read/write support. Embed files into PDFs (ZUGFeRD / Factur-X). Gotenberg version compatibility checking with clear errors for unsupported features.
v3.0.0 - Major release: Screenshot operations (HTML/URL to PNG/JPEG/WebP). Standalone PDF engine operations (flatten, rotate, split, encrypt, metadata). Cross-cutting watermark, stamp, rotation, and split options. LibreOffice conversion options. PDF encryption. Additional Chromium fields. Dropped .NET 5/6/7; added .NET 9/10. Namespace reorganization (builders moved to Application layer). See CHANGES.MD for full details.
v2.8.5 - Added support for the GenerateTaggedPdf flag.
v2.8.4 - Fixed hybrid configuration for basic authentication credentials.
v2.8.3 - Added programmatic configuration support. Comprehensive documentation improvements.
v2.8.1 - Added cookie support, basic auth, SinglePage property.
v2.8 - PDF formatting improvements, flatten support.
v2.0 - Upgraded to support Gotenberg v7.