Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [8.x]
dotnet-version: [10.x]

steps:
- name: Checkout
Expand Down Expand Up @@ -60,6 +60,17 @@ jobs:
GOTENBERG_USERNAME: testuser
GOTENBERG_PASSWORD: testpass

# The project treats trim and AOT warnings as errors, so the publish fails if the client regresses.
- name: Publish AOT smoke test
run: dotnet publish test/GotenbergSharpClient.AotSmokeTest -c Release -r linux-x64 -o aot-smoke-test

- name: Run AOT smoke test
run: ./aot-smoke-test/GotenbergSharpClient.AotSmokeTest
env:
GOTENBERG_URL: http://localhost:3000
GOTENBERG_USERNAME: testuser
GOTENBERG_PASSWORD: testpass

- name: Pack
run: dotnet pack src/Gotenberg.Sharp.Api.Client/Gotenberg.Sharp.Api.Client.csproj -c Release -p:PackageVersion=${{ steps.gitversion.outputs.FullSemVer }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg

Expand Down
13 changes: 13 additions & 0 deletions CHANGES.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Release History

## Unreleased
- **Native AOT and Trimming Support:**
- The package is marked `IsAotCompatible` for .NET 8 and newer and builds without trim or AOT warnings
- JSON is now written and read with source-generated `System.Text.Json`; the `Newtonsoft.Json` dependency is removed
- New `test/GotenbergSharpClient.AotSmokeTest` project publishes the client with Native AOT and exercises it end to end
- **Breaking Changes:**
- `JObject` is gone from the public API. `PdfOutputOptions.MetaData`, `WriteMetadataRequest.Metadata`, `WatermarkOptions.Options`, `StampOptions.Options`, and `HtmlConversionBehaviors.ExtraHeaders` are now `IDictionary<string, object>`
- Builder overloads that took a `JObject` (`SetMetadata`, `WriteMetadata`, `SetOptions`, `AddAdditionalHeaders`) now take an `IDictionary<string, object>` or a `System.Text.Json.Nodes.JsonObject`
- Dictionary values must be strings, numbers, booleans, dates, dictionaries, collections, or `JsonNode`/`JsonElement`; other object types throw `NotSupportedException` instead of being serialized by reflection
- `ReadPdfBookmarksAsync()` throws `System.Text.Json.JsonException` on malformed JSON instead of a Newtonsoft exception
- `GotenbergApiException.ToVerboseJson()` writes a fixed set of response and request fields rather than a reflection dump of the underlying objects
- JSON form fields are sent compact rather than indented

## v3.1.0
- **PDF Bookmarks (Issue #79):**
- New `PdfEngineBuilders.ReadBookmarks()`, `WriteBookmarks()`, and `WriteBookmarksPerFile()`
Expand Down
109 changes: 109 additions & 0 deletions GotenbergSharpApiClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UrlsToMergedPdf", "examples
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Webhook", "examples\Webhook\Webhook.csproj", "{01C9F662-6378-3FC4-B629-9FD37A38033D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0C88DD14-F956-CE84-757C-A364CCF449FC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GotenbergSharpClient.AotSmokeTest", "test\GotenbergSharpClient.AotSmokeTest\GotenbergSharpClient.AotSmokeTest.csproj", "{64363F41-ACC1-48AA-A37A-43E2FA67C611}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChromiumFeatures", "examples\ChromiumFeatures\ChromiumFeatures.csproj", "{4867319B-585F-4ADD-95A1-FDCFB8017F11}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EncryptPdf", "examples\EncryptPdf\EncryptPdf.csproj", "{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreOfficeOptions", "examples\LibreOfficeOptions\LibreOfficeOptions.csproj", "{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Screenshot", "examples\Screenshot\Screenshot.csproj", "{1B555B39-70B8-4DEB-9C12-757A5516A68B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatermarkAndRotate", "examples\WatermarkAndRotate\WatermarkAndRotate.csproj", "{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PdfEngineOperations", "examples\PdfEngineOperations\PdfEngineOperations.csproj", "{DB62A461-4823-4705-A7F3-302B72A0D767}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -174,6 +192,90 @@ Global
{01C9F662-6378-3FC4-B629-9FD37A38033D}.Release|x64.Build.0 = Release|Any CPU
{01C9F662-6378-3FC4-B629-9FD37A38033D}.Release|x86.ActiveCfg = Release|Any CPU
{01C9F662-6378-3FC4-B629-9FD37A38033D}.Release|x86.Build.0 = Release|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Debug|x64.ActiveCfg = Debug|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Debug|x64.Build.0 = Debug|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Debug|x86.ActiveCfg = Debug|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Debug|x86.Build.0 = Debug|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Release|Any CPU.Build.0 = Release|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Release|x64.ActiveCfg = Release|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Release|x64.Build.0 = Release|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Release|x86.ActiveCfg = Release|Any CPU
{64363F41-ACC1-48AA-A37A-43E2FA67C611}.Release|x86.Build.0 = Release|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Debug|x64.ActiveCfg = Debug|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Debug|x64.Build.0 = Debug|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Debug|x86.ActiveCfg = Debug|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Debug|x86.Build.0 = Debug|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Release|Any CPU.Build.0 = Release|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Release|x64.ActiveCfg = Release|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Release|x64.Build.0 = Release|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Release|x86.ActiveCfg = Release|Any CPU
{4867319B-585F-4ADD-95A1-FDCFB8017F11}.Release|x86.Build.0 = Release|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Debug|x64.ActiveCfg = Debug|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Debug|x64.Build.0 = Debug|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Debug|x86.ActiveCfg = Debug|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Debug|x86.Build.0 = Debug|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Release|Any CPU.Build.0 = Release|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Release|x64.ActiveCfg = Release|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Release|x64.Build.0 = Release|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Release|x86.ActiveCfg = Release|Any CPU
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A}.Release|x86.Build.0 = Release|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Debug|x64.ActiveCfg = Debug|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Debug|x64.Build.0 = Debug|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Debug|x86.ActiveCfg = Debug|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Debug|x86.Build.0 = Debug|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Release|Any CPU.Build.0 = Release|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Release|x64.ActiveCfg = Release|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Release|x64.Build.0 = Release|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Release|x86.ActiveCfg = Release|Any CPU
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006}.Release|x86.Build.0 = Release|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Debug|x64.ActiveCfg = Debug|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Debug|x64.Build.0 = Debug|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Debug|x86.ActiveCfg = Debug|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Debug|x86.Build.0 = Debug|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Release|Any CPU.Build.0 = Release|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Release|x64.ActiveCfg = Release|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Release|x64.Build.0 = Release|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Release|x86.ActiveCfg = Release|Any CPU
{1B555B39-70B8-4DEB-9C12-757A5516A68B}.Release|x86.Build.0 = Release|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Debug|x64.ActiveCfg = Debug|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Debug|x64.Build.0 = Debug|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Debug|x86.ActiveCfg = Debug|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Debug|x86.Build.0 = Debug|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Release|Any CPU.Build.0 = Release|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Release|x64.ActiveCfg = Release|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Release|x64.Build.0 = Release|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Release|x86.ActiveCfg = Release|Any CPU
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48}.Release|x86.Build.0 = Release|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Debug|x64.ActiveCfg = Debug|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Debug|x64.Build.0 = Debug|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Debug|x86.ActiveCfg = Debug|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Debug|x86.Build.0 = Debug|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Release|Any CPU.Build.0 = Release|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Release|x64.ActiveCfg = Release|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Release|x64.Build.0 = Release|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Release|x86.ActiveCfg = Release|Any CPU
{DB62A461-4823-4705-A7F3-302B72A0D767}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -188,6 +290,13 @@ Global
{9C18F2D1-E9E9-613A-DE10-4263A2EA8A17} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{A4D0B498-A934-2F11-2AA7-18D1D1C9E881} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{01C9F662-6378-3FC4-B629-9FD37A38033D} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{64363F41-ACC1-48AA-A37A-43E2FA67C611} = {0C88DD14-F956-CE84-757C-A364CCF449FC}
{4867319B-585F-4ADD-95A1-FDCFB8017F11} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{E4E3BD40-0FE4-4A5A-9D2D-5B626A68CC6A} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{0AB269E4-CE02-4BC7-86E0-B0E653DF6006} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{1B555B39-70B8-4DEB-9C12-757A5516A68B} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{5AE2A0D6-0D8A-414D-B850-E65FA3FBEB48} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{DB62A461-4823-4705-A7F3-302B72A0D767} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E732CE09-693A-4EB7-BC1C-34E0D4E2E19F}
Expand Down
7 changes: 3 additions & 4 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,9 @@ services.AddGotenbergSharpClient();

```csharp
using Gotenberg.Sharp.API.Client;
using Gotenberg.Sharp.API.Client.Domain.Builders;
using Gotenberg.Sharp.API.Client.Domain.Builders.Faceted;
using Gotenberg.Sharp.API.Client.Domain.Requests.Facets;
using Gotenberg.Sharp.API.Client.Domain.ValueObjects;
using Gotenberg.Sharp.API.Client.Application.Builders;
using Gotenberg.Sharp.API.Client.Domain.Settings;
using Gotenberg.Sharp.API.Client.Extensions;
```

## Your First PDF
Expand Down
2 changes: 1 addition & 1 deletion examples/ChromiumFeatures/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Gotenberg.Sharp.API.Client;
using Gotenberg.Sharp.API.Client.Domain.Builders;
using Gotenberg.Sharp.API.Client.Application.Builders;
using Gotenberg.Sharp.API.Client.Domain.Settings;
using Gotenberg.Sharp.API.Client.Infrastructure.Pipeline;

Expand Down
16 changes: 8 additions & 8 deletions examples/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand All @@ -12,13 +12,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion examples/EncryptPdf/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Gotenberg.Sharp.API.Client;
using Gotenberg.Sharp.API.Client.Domain.Builders;
using Gotenberg.Sharp.API.Client.Application.Builders;
using Gotenberg.Sharp.API.Client.Domain.Settings;
using Gotenberg.Sharp.API.Client.Infrastructure.Pipeline;

Expand Down
3 changes: 2 additions & 1 deletion examples/LibreOfficeOptions/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Gotenberg.Sharp.API.Client;
using Gotenberg.Sharp.API.Client.Domain.Builders;
using Gotenberg.Sharp.API.Client.Application.Builders;
using Gotenberg.Sharp.API.Client.Domain.PdfFormat;
using Gotenberg.Sharp.API.Client.Domain.Settings;
using Gotenberg.Sharp.API.Client.Infrastructure.Pipeline;

Expand Down
7 changes: 4 additions & 3 deletions examples/PdfEngineOperations/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Gotenberg.Sharp.API.Client.Infrastructure.Pipeline;

using Microsoft.Extensions.Configuration;
using Newtonsoft.Json.Linq;
using System.Text.Json;

var config = new ConfigurationBuilder()
.SetBasePath(AppContext.BaseDirectory)
Expand Down Expand Up @@ -56,8 +56,9 @@
Console.WriteLine("Reading metadata...");
var metadataJson = await sharpClient.ReadPdfMetadataAsync(
PdfEngineBuilders.ReadMetadata().WithPdfs(a => a.AddItem("test.pdf", pdfBytes)));
var parsed = JObject.Parse(metadataJson);
Console.WriteLine($"Metadata: {parsed.ToString(Newtonsoft.Json.Formatting.Indented)}");
using var parsed = JsonDocument.Parse(metadataJson);
var indented = JsonSerializer.Serialize(parsed.RootElement, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine($"Metadata: {indented}");

// Bookmarks require Gotenberg 8.28.0, so skip the demo rather than fail on older services.
var version = await sharpClient.GetGotenbergVersionAsync();
Expand Down
4 changes: 2 additions & 2 deletions examples/Screenshot/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Gotenberg.Sharp.API.Client;
using Gotenberg.Sharp.API.Client.Domain.Builders;
using Gotenberg.Sharp.API.Client.Domain.ValueObjects;
using Gotenberg.Sharp.API.Client.Application.Builders;
using Gotenberg.Sharp.API.Client.Domain.Screenshots;
using Gotenberg.Sharp.API.Client.Domain.Settings;
using Gotenberg.Sharp.API.Client.Infrastructure.Pipeline;

Expand Down
4 changes: 2 additions & 2 deletions examples/WatermarkAndRotate/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Gotenberg.Sharp.API.Client;
using Gotenberg.Sharp.API.Client.Domain.Builders;
using Gotenberg.Sharp.API.Client.Domain.ValueObjects;
using Gotenberg.Sharp.API.Client.Application.Builders;
using Gotenberg.Sharp.API.Client.Domain.Rotation;
using Gotenberg.Sharp.API.Client.Domain.Settings;
using Gotenberg.Sharp.API.Client.Infrastructure.Pipeline;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
using Gotenberg.Sharp.API.Client.Domain.Shared;
using Gotenberg.Sharp.API.Client.Domain.Split;

using Newtonsoft.Json.Linq;
using System.Text.Json.Nodes;

namespace Gotenberg.Sharp.API.Client.Application.Builders;

Expand Down Expand Up @@ -139,21 +139,21 @@ public static PdfEngineBuilder<ReadMetadataRequest> ReadMetadata()
/// <summary>
/// Creates a builder for writing metadata to PDFs.
/// </summary>
public static PdfEngineBuilder<WriteMetadataRequest> WriteMetadata(JObject metadata)
public static PdfEngineBuilder<WriteMetadataRequest> WriteMetadata(IDictionary<string, object> metadata)
{
var request = new WriteMetadataRequest
{
Metadata = metadata ?? throw new ArgumentNullException(nameof(metadata))
Metadata = JsonObjectWriter.Snapshot(metadata ?? throw new ArgumentNullException(nameof(metadata)))
};
return new PdfEngineBuilder<WriteMetadataRequest>(request);
}

/// <summary>
/// Creates a builder for writing metadata to PDFs.
/// </summary>
public static PdfEngineBuilder<WriteMetadataRequest> WriteMetadata(IDictionary<string, object> metadata)
public static PdfEngineBuilder<WriteMetadataRequest> WriteMetadata(JsonObject metadata)
{
return WriteMetadata(JObject.FromObject(metadata));
return WriteMetadata(JsonObjectWriter.ToDictionary(metadata));
}

/// <summary>
Expand Down
Loading