Stamp every page of a PDF with a diagonal watermark without uploading the file anywhere. The stamp is a real text element, so 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.
