Add a watermark to a PDF without uploading the file anywhere. The PDF watermark lands on every page at an angle, and because the stamp is a real text element it stays editable right up until you export.
Every page, sized to that page
The watermark is placed per page rather than once for the document. Font size comes from each page's diagonal, so a landscape insert in a portrait report gets a stamp in proportion to its own page. Documents that mix A4 and A3, or slip a chart in sideways, come out looking deliberate rather than patched.
It stays editable
Once the PDF parses, the document opens in the embedded editor with the watermark already applied. Select it on any page to change the text, colour, angle, or opacity, or delete it from a page that should not carry it. The export renders what you see.
What this is not
It is not a security control. The watermark is an ordinary element drawn on top of the page, and anyone who opens the exported file in a PDF editor can remove it. It is useful for marking a draft, an internal copy, or a proof. It will not stop a determined recipient, and no client-side watermark will.
The same operation in code
import { pdfToJson } from "@polotno/pdf-import";
import { jsonToPDFBlob } from "@polotno/pdf-export/browser";
const design = await pdfToJson({ pdf: await file.arrayBuffer() });
for (const page of design.pages) {
page.children.push({
type: "text",
text: "CONFIDENTIAL",
fontSize: 96,
fill: "#ff0000",
opacity: 0.25,
rotation: -35,
align: "center",
alwaysOnTop: true,
// position from the page box
x: 0,
y: design.height / 2,
width: design.width,
});
}
const blob = await jsonToPDFBlob(design);The same loop runs under Node for batch work. See PDF import, PDF export, and PDF editing in the SDK.
As an API, without the browser
The same watermark runs server-side. Post the design to the Cloud Render API and get the watermarked file back, or run the renderer inside your own infrastructure when the documents cannot leave your network. Both paths take the identical schema, so a preview on this page and a file from a queue never disagree.
Watermarking an image works the same way, because the watermark is an element on the design whichever format comes out. See the watermark API for the pattern, and PDF generation for stamping documents generated from data.
