xtract.bot
POST /api/pdf-watermark

Stamp a text watermark across every page of a PDF. Configurable text, font size, opacity, rotation, and colour. Preserves the original document content.

Stamps a text watermark across every page of a PDF. The original page content is preserved underneath. Options: - `text`: the watermark string (e.g. `CONFIDENTIAL`, `DRAFT`, `Property of Acme`). - `fontSize` (default 60): point size. - `opacity` (default 0.3): 0–1. - `rotation` (default -30°): degrees from horizontal. - `color` (default `#777777`): hex colour. Use this for `DRAFT` / `CONFIDENTIAL` markings, attribution strings, or copy-tracking IDs.

Inputs

NameTypeDefaultDescription
pdf*fileThe PDF to watermark.
text*stringWatermark text (1.200 chars).
positionenum (top-left | top-center | top-right | center-left | center | center-right | bottom-left | bottom-center | bottom-right | diagonal)"diagonal"Where to place the text.
fontSizenumber (6…256)48Font size in points.
opacitynumber (0…1)0.25Watermark opacity (0.1).
colorstring"gray"'#rrggbb' or one of black/white/red/blue/gray/green.
boldbooleantrueUse Helvetica-Bold (true) or Helvetica (false).

Response

Modes: binary, base64-json. Cache: yes (24h TTL).

Code samples

Built from the draft-diagonal example.

# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/pdf-extract-text/hello.pdf
PDF=$(base64 -w0 < hello.pdf)

curl -X POST https://api.xtract.bot/api/pdf-watermark \
  -H "Content-Type: application/json" \
  -H "Accept: application/octet-stream" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "text": "DRAFT",
  "position": "diagonal",
  "fontSize": 64,
  "opacity": 0.25,
  "color": "gray",
  "bold": true,
  "pdf": "'"$PDF"'"
}'