Skip to content

feat: add embed on pdfengine - #78

Open
kokoISnoTarget wants to merge 4 commits into
ChangemakerStudios:developfrom
kokoISnoTarget:feat/add-embed-on-pdfbuilder
Open

feat: add embed on pdfengine#78
kokoISnoTarget wants to merge 4 commits into
ChangemakerStudios:developfrom
kokoISnoTarget:feat/add-embed-on-pdfbuilder

Conversation

@kokoISnoTarget

@kokoISnoTarget kokoISnoTarget commented Aug 3, 2026

Copy link
Copy Markdown

Hello,

this implements the basic embed endpoint on pdfengine.
https://gotenberg.dev/docs/manipulate-pdfs/attachments

Let me know if there is anything missing or to be changed.

Summary by CodeRabbit

  • New Features

    • Added support for embedding files and metadata into generated PDFs.
    • Added configurable embed relationships, including source, data, alternative, supplement, and unspecified.
    • Added support for specifying embedded content MIME types and filenames.
  • Tests

    • Added unit and integration coverage for PDF embedding, including XML content embedding.
    • Added validation that embedded content produces a non-empty PDF result.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 671d6966-6d6d-4fc0-9819-e20262d2a2b9

📥 Commits

Reviewing files that changed from the base of the PR and between 36e829a and 1f84d5b.

📒 Files selected for processing (3)
  • src/Gotenberg.Sharp.Api.Client/Domain/Requests/EmbedRequest.cs
  • src/Gotenberg.Sharp.Api.Client/Infrastructure/Constants.cs
  • test/GotenbergSharpClient.Tests/PdfEngineOperationsTests.cs
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/Gotenberg.Sharp.Api.Client/Infrastructure/Constants.cs
  • src/Gotenberg.Sharp.Api.Client/Domain/Requests/EmbedRequest.cs
  • test/GotenbergSharpClient.Tests/PdfEngineOperationsTests.cs

📝 Walkthrough

Walkthrough

The change adds PDF embedding support. It defines embed metadata, builds multipart embed requests, exposes the embed API route and relation constants, and validates request creation and generated PDF output.

Changes

PDF embedding

Layer / File(s) Summary
Embed contract and API constants
src/Gotenberg.Sharp.Api.Client/Domain/Embed/Entry.cs, src/Gotenberg.Sharp.Api.Client/Infrastructure/Constants.cs
Adds the Entry model, the embed API path, and supported embed relation constants.
Embed request construction
src/Gotenberg.Sharp.Api.Client/Domain/Requests/EmbedRequest.cs, src/Gotenberg.Sharp.Api.Client/Application/Builders/PdfEngineBuilder.cs
Adds embed metadata validation, JSON metadata, multipart content, optional MIME types, and the PdfEngineBuilders.Embed factory method.
Embed builder and integration validation
test/GotenbergSharpClient.Tests/PdfEngineOperationsTests.cs
Tests embed request creation and verifies that XML embedding produces non-empty PDF output.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PdfEngineBuilders
  participant EmbedRequest
  participant PDFEngineAPI
  participant PDFOutput
  PdfEngineBuilders->>EmbedRequest: create configured embed request
  EmbedRequest->>PDFEngineAPI: send JSON metadata and multipart embed content
  PDFEngineAPI-->>PDFOutput: return embedded PDF
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding embed support to the PDF engine.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Gotenberg.Sharp.Api.Client/Domain/Requests/EmbedRequest.cs`:
- Around line 17-23: Update the InvalidOperationException message in
EmbedRequest.Validate to reference the actual EmbedsData property instead of
EmbedsMetadata, preserving the existing validation condition and exception
behavior.

In `@src/Gotenberg.Sharp.Api.Client/Infrastructure/Constants.cs`:
- Around line 276-283: Update the constants in EmbedRelation so Source, Data,
Alternative, Supplement, and Unspecified use Gotenberg’s capitalized
/AFRelationship values instead of lowercase strings.

In `@test/GotenbergSharpClient.Tests/PdfEngineOperationsTests.cs`:
- Around line 231-267: Rename the Emend test to a descriptive <Feature>_Succeeds
name matching the PDF embed operation, such as Embed_Succeeds. In the test
method, dispose the API response using the existing using-var pattern, write it
through a disposed file stream, and remove the result.pdf artifact-writing block
unless it is required for the assertion; assert the disposed result’s length
before disposal.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8679bc68-5020-4069-a560-ab1ac62bf35e

📥 Commits

Reviewing files that changed from the base of the PR and between f1dc8c9 and 36e829a.

📒 Files selected for processing (5)
  • src/Gotenberg.Sharp.Api.Client/Application/Builders/PdfEngineBuilder.cs
  • src/Gotenberg.Sharp.Api.Client/Domain/Embed/Entry.cs
  • src/Gotenberg.Sharp.Api.Client/Domain/Requests/EmbedRequest.cs
  • src/Gotenberg.Sharp.Api.Client/Infrastructure/Constants.cs
  • test/GotenbergSharpClient.Tests/PdfEngineOperationsTests.cs

Comment thread src/Gotenberg.Sharp.Api.Client/Domain/Requests/EmbedRequest.cs
Comment thread src/Gotenberg.Sharp.Api.Client/Infrastructure/Constants.cs
Comment thread test/GotenbergSharpClient.Tests/PdfEngineOperationsTests.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant