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:
| Engine | Syntax Reference |
|---|---|
| pdfcpu (Default) | See pdfcpu stamp documentation |
| pdftk | See 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
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
- 200
- 400
- 503
Content-Disposition: attachment; filename={output-filename.ext}
Content-Type: {content-type}
Content-Length: {content-length}
Gotenberg-Trace: {trace}
Body: {output-file}
Content-Type: text/plain; charset=UTF-8
Gotenberg-Trace: {trace}
Body: {error}
Content-Type: text/plain; charset=UTF-8
Gotenberg-Trace: {trace}
Body: {error}
Multiple Stamps
Repeat the stamp form fields to apply several stamps in one request. Gotenberg reads stampSource, stampExpression, stampPages, and stampOptions as parallel lists and applies each stamp in order. A single occurrence of each field is the single-stamp case above.
Each image or pdf stamp consumes the uploaded stamp files in order; text stamps take none.
curl \
--request POST http://localhost:3000/forms/pdfengines/stamp \
--form files=@/path/to/file.pdf \
--form stampSource=text --form stampExpression=CONFIDENTIAL \
--form stampSource=image --form stamp=@/path/to/logo.png \
-o my.pdf
What's Next?
Fix page orientation with Rotate, or combine files with Merge.