Skip to main content
Version: 9.x

Stamp an image

Draws an uploaded PNG or JPEG image over pages: a logo, a signature, a seal.

POST/forms/pdf/stamp-image
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.

imagefilerequired

The uploaded .png, .jpg or .jpeg image.

The pages to stamp.

Default: all

xnumber

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

Default: 0

ynumber

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

Default: 0

widthnumber

In points. Set width or height to keep the proportions; set neither to draw each pixel as a point.

heightnumber

In points.

opacitynumber

From 0 to 1. Unset, or 0, draws the image 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.

curl \
--request POST http://localhost:3000/forms/pdf/stamp-image \
--form files=@report.pdf \
--form files=@logo.png \
--form image=logo.png \
--form x=374 \
--form y=24 \
--form width=48 \
--form pages=1 \
-o report.pdf

Set width or height and Gotenberg keeps the image's proportions. The image is a PNG or a JPEG.

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=@logo.png \
--form 'stages=[
{ "op": "stamp-image", "image": "logo.png", "x": 36, "y": 36, "width": 64 }
]' \
-o report.pdf