Skip to main content
Version: 9.x

Stamp text

Draws a line of text over pages: a watermark, a label, a status.

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

The PDFs.

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.

textstringrequired

The text to draw.

The pages to stamp.

Default: all

xnumber

The position, in points from the left edge.

Default: 0

ynumber

The position, in points from the bottom edge.

Default: 0

fontSizenumber

The size of the text, in points. Greater than 0.

Default: 12

fontstring

One of the 14 standard PDF fonts: Helvetica, Times-Roman, Courier, their -Bold, -Oblique or -Italic variants, or Symbol and ZapfDingbats, which draw Western European text as symbols. Text outside Western European takes an installed font, of the same family when one has its characters.

Default: Helvetica

colorstring

The color, as #rrggbb.

Default: #000000

opacitynumber

From 0 to 1. Unset, or 0, draws the text 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-text \
--form files=@report.pdf \
--form text=CONFIDENTIAL \
--form x=120 \
--form y=250 \
--form fontSize=36 \
--form color=#b42318 \
--form opacity=0.4 \
--form rotation=30 \
-o report.pdf

rotation turns the text counter-clockwise around x and y. font takes one of the 14 standard PDF fonts, Helvetica by default, which draw Western European text; Symbol and ZapfDingbats draw it as symbols. Other text, Cyrillic or Chinese for instance, is drawn with a font installed in the image, one of the family of font when it has the characters, embedded in the PDF. Letters that join or reorder, as Arabic and Devanagari do, come out one by one. Text no installed font has the characters of answers 400: install a font that does.

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 'stages=[
{ "op": "stamp-text", "text": "CONFIDENTIAL", "x": 120, "y": 250, "fontSize": 36, "color": "#b42318", "opacity": 0.4, "rotation": 30 }
]' \
-o report.pdf

A stamp only covers what's under it: redact to remove content for good.