Skip to content

feat: add watermark (release 8.28)#249

Open
StevenRenaux wants to merge 3 commits intosensiolabs:1.xfrom
StevenRenaux:feat/Release-8.28-Add-Watermark
Open

feat: add watermark (release 8.28)#249
StevenRenaux wants to merge 3 commits intosensiolabs:1.xfrom
StevenRenaux:feat/Release-8.28-Add-Watermark

Conversation

@StevenRenaux
Copy link
Copy Markdown
Collaborator

@StevenRenaux StevenRenaux commented Apr 6, 2026

Q A
Gotenberg API version ? 8.28
Bug fix ? no
New feature ? yes
BC break ? no

Description

  • Add WatermarkSource enum (text, image, pdf)
  • Add WatermarkTrait with 5 fields: watermarkSource, watermarkExpression, watermarkPages, watermarkOptions, watermarkFile
  • Add WatermarkPdfBuilder (POST /forms/pdfengines/watermark) with full payload validation (requires Gotenberg >= 8.28)
  • Compose WatermarkTrait into ChromiumPdfTrait, LibreOfficeTrait, MergePdfBuilder, SplitPdfBuilder
  • Expose watermark() on GotenbergPdfInterface, GotenbergPdf, TraceableGotenbergPdf
  • Add WatermarkTestCaseTrait + WatermarkPdfBuilderTest; extend existing builder tests
  • Add 3 pre-existing NodeBuilder generics ignore entries to phpstan.dist.neon
  • Regenerate API docs

@StevenRenaux StevenRenaux requested review from Jean-Beru and Neirda24 and removed request for Jean-Beru April 6, 2026 10:57
@StevenRenaux StevenRenaux changed the title [REALEASE 8.28] Add Watermark [RELEASE 8.28] Add Watermark Apr 6, 2026
@StevenRenaux StevenRenaux force-pushed the feat/Release-8.28-Add-Watermark branch 3 times, most recently from 6ecb7e9 to 1a6ebc4 Compare April 6, 2026 11:18
@StevenRenaux StevenRenaux changed the title [RELEASE 8.28] Add Watermark feat(release 8.28): Add Watermark Apr 6, 2026
@Jean-Beru Jean-Beru changed the title feat(release 8.28): Add Watermark feat: add watermark (release 8.28) Apr 7, 2026
Copy link
Copy Markdown
Contributor

@Jean-Beru Jean-Beru left a comment

Choose a reason for hiding this comment

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

Review by Claude (claude.ai/code).

This PR mirrors #250 (stamp) for watermark support. Same structure, same patterns. Three issues found -- two are shared with #250, one is specific to this PR.

Comment thread src/Builder/Pdf/WatermarkPdfBuilder.php Outdated
Comment thread src/Builder/Pdf/WatermarkPdfBuilder.php
@Jean-Beru
Copy link
Copy Markdown
Contributor

Missing service registration and bundle wiring -- Review by Claude (claude.ai/code)

Compared with #250 (stamp), this PR is missing three key files:

  1. config/builder_pdf.php -- no service definition for .sensiolabs_gotenberg.pdf_builder.watermark. Without this, the DI container won't know about WatermarkPdfBuilder.

  2. src/SensiolabsGotenbergBundle.php -- WatermarkPdfBuilder::class is not registered via $extension->registerBuilder().

  3. src/DependencyInjection/SensiolabsGotenbergExtension.php -- the watermark key is not added to the phpdoc type for the pdf config array.

Without these, calling $gotenberg->watermark() will fail at runtime because the builder won't be resolved from the container.

@StevenRenaux StevenRenaux force-pushed the feat/Release-8.28-Add-Watermark branch 3 times, most recently from 894cc43 to c7f9508 Compare April 10, 2026 17:54
@StevenRenaux StevenRenaux requested a review from Jean-Beru April 10, 2026 18:00
Comment thread src/Builder/Behaviors/WatermarkTrait.php Outdated
Comment thread src/Builder/Behaviors/WatermarkTrait.php Outdated
Comment thread src/Builder/Pdf/WatermarkPdfBuilder.php
Comment on lines +78 to +82

/**
* @return WatermarkPdfBuilder
*/
public function watermark(): BuilderInterface;
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.

Same as the PR about stamps. It's a BC break. Maybe we can skip this change and deprecate this interface if not useful.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Depending of what you decide with @Neirda24

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.

2 participants