Gotenberg.Sharp.API.Client 3.0.0

dotnet add package Gotenberg.Sharp.API.Client --version 3.0.0
                    
NuGet\Install-Package Gotenberg.Sharp.API.Client -Version 3.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Gotenberg.Sharp.API.Client" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Gotenberg.Sharp.API.Client" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Gotenberg.Sharp.API.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Gotenberg.Sharp.API.Client --version 3.0.0
                    
#r "nuget: Gotenberg.Sharp.API.Client, 3.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Gotenberg.Sharp.API.Client@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Gotenberg.Sharp.API.Client&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Gotenberg.Sharp.API.Client&version=3.0.0
                    
Install as a Cake Tool

<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>

NuGet version Downloads Build status

.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.0.0 — Screenshots, standalone PDF operations (flatten/rotate/split/encrypt), cross-cutting watermark & stamp options, LibreOffice conversion options, .NET 10/9/8 + netstandard 2.x. 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
  • PDF/A & PDF/UA compliance, metadata read/write
  • Webhooks for async PDF generation
  • DI-Ready with Polly retry policies

Quick Start

docker run --rm -p 3000:3000 gotenberg/gotenberg:latest
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:

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" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=ChangemakerStudios/GotenbergSharpApiClient&type=date&legend=bottom-right" /> <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=ChangemakerStudios/GotenbergSharpApiClient&type=date&legend=bottom-right" /> </picture> </a>

License

Apache 2.0

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.0 718 4/6/2026
2.8.5 4,490 3/27/2026
2.8.4 134,164 10/18/2025
2.8.3 30,241 10/6/2025
2.8.1 534 10/5/2025
2.8.0 280,640 3/25/2025
2.5.0 48,863 2/7/2025
2.4.0 235,602 8/10/2024
2.3.0 122,232 4/17/2024
2.2.2 65,185 1/30/2024
2.1.1 326,754 10/1/2022
2.0.2 68,172 8/30/2022
2.0.1 1,576 8/30/2022
2.0.0-alpha0002 36,109 3/3/2022
1.2.0 110,844 5/11/2021
Loading failed

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.