Skip to main content
Version: 9.x

Stamp a PDF page

Draws a page of another PDF over pages: a letterhead, a seal.

POST/forms/pdf/stamp-pdf
filesfile[]required

The PDFs, and the files the options name.

archivesfile[]

ZIP files Gotenberg unpacks: each entry counts as a file uploaded under files.

URLs Gotenberg downloads first, as if you had uploaded the files. Each entry takes a url, and optionally extraHttpHeaders.

sourcefilerequired

The uploaded PDF to draw.

sourcePageinteger

The page of source to draw.

Default: 1

The pages to stamp.

Default: all

xnumber

The left edge, in points from the left of the page.

Default: 0

ynumber

The bottom edge, in points from the bottom of the page.

Default: 0

scalenumber

The scale factor. Greater than 0.

Default: 1

opacitynumber

From 0 to 1. Unset, or 0, draws the page opaque.

rotationnumber

Degrees, counter-clockwise, around x and y.

Default: 0

The PDF, or a ZIP of the PDFs when you send several.

The route also takes the headers. An error answers a status and a message: see Errors.

Place a stamp​

A stamp's x and y count in points from the bottom-left corner of the page, 72 points to the inch. A Letter page measures 612 by 792 points, an A4 page 595 by 842. Without pages, a stamp goes on every page.

Stamp a letterhead​

curl \
--request POST http://localhost:3000/forms/pdf/stamp-pdf \
--form files=@report.pdf \
--form files=@letterhead.pdf \
--form source=letterhead.pdf \
-o report.pdf

Draw the letterhead on a transparent page, so the content under it shows: Chromium makes one from HTML with printBackground and omitBackground. scale resizes the page, and sourcePage picks another page of the source.

In a list of stages​

The stage also runs in a list on /forms/pdf/pipe, and on the PDFs a Chromium or LibreOffice conversion makes, in its stages field:

curl \
--request POST http://localhost:3000/forms/pdf/pipe \
--form files=@report.pdf \
--form files=@annex.pdf \
--form 'stages=[
{ "op": "stamp-pdf", "source": "annex.pdf", "scale": 0.5, "opacity": 0.3 }
]' \
-o report.pdf