Skip to main content

Stamp PDFs

Adds a stamp on top of the content of each page of one or more PDF files. Use text for a simple label, image to overlay an uploaded image, or pdf to place a full-page PDF on top.

See the PDF Engines module configuration for engine selection flags.

The stampOptions form field accepts a JSON object whose keys depend on the configured PDF engine:

EngineSyntax Reference
pdfcpu (Default)See pdfcpu stamp documentation
pdftkSee pdftk documentation

Available keys include font, points (font size), color, rotation, opacity, scale, offset, and more. Example:

{
"font": "Helvetica",
"points": 24,
"color": "#008000",
"rotation": 0,
"opacity": 0.6
}

Check the PDF Engines module configuration to see which engine is active.

Basics

POST/forms/pdfengines/stamp
Headers
Gotenberg-Output-Filenamestring
The filename of the resulting file - Gotenberg automatically appends the file extension. Defaults to a random UUID filename.
Gotenberg-Tracestring
A custom request ID to identify the request in the logs; overrides the default UUID.
Form Fields
stampSourceenumrequired
The stamp source type. Options: text, image, pdf.
stampExpressionstringrequired
The stamp content. For text, the string to render. For image or pdf, the filename of the uploaded stamp file.
stampPagesstring
Page ranges to stamp (e.g., 1-3, 5). Empty means all pages.
stampOptionsjson
Advanced options in JSON format (e.g., font, color, rotation, opacity, scaling).
Form Files
filesfile[]required
PDF files to stamp.
stampfile
An image or PDF file used as stamp source (required when stampSource is image or pdf).
cURL
curl \
--request POST http://localhost:3000/forms/pdfengines/stamp \
--form files=@/path/to/file.pdf \
--form stampSource=text \
--form stampExpression=APPROVED \
--form 'stampOptions={"opacity":0.5,"rotation":0}' \
-o my.pdf
The stamped PDF file. Multiple input files produce a ZIP archive.
Content-Disposition: attachment; filename={output-filename.ext}
Content-Type: {content-type}
Content-Length: {content-length}
Gotenberg-Trace: {trace}
Body: {output-file}

What's Next?

Fix page orientation with Rotate, or combine files with Merge.