How the stamp is drawn
The tool loads your PDF with pdf-lib and draws the watermark on top of the existing page content, which is why it never sits "behind" the text. For a text watermark it embeds the built-in Helvetica Bold font, measures the string with widthOfTextAtSize, and then places it according to the position you chose. Opacity is applied as a PDF transparency value, so the page content shows through.
Text positions
| Position | What is drawn |
|---|---|
| Diagonal | One copy rotated 45 degrees, with its midpoint at the exact centre of the page |
| Center | One horizontal copy centered across the page |
| Tiled | Copies rotated -30 degrees, repeated with a horizontal gap of the text width plus three font sizes and a vertical gap of four font sizes |
| Corners | Horizontal text 28 pt from the chosen edges |
Image watermarks (PNG or JPG) support center and the four corners, a scale from 5 to 100 percent of the largest size that fits the page, and the same opacity slider, with 24 pt padding in corners.
Worked example
With the defaults, "CONFIDENTIAL" at 48 pt in Helvetica Bold measures 357.3 pt wide. On a US Letter page (612 x 792 pt), the diagonal mode works out where the text must start so that, after the 45 degree rotation, the middle of the string lands on the page centre at (306, 396). The tool computes the start point from the text width and the font's cap height, so the mark stays centred at any font size.
Limits and gotchas
- Latin characters only. The standard font uses WinAnsi encoding. Before drawing anything, the tool checks your text and, if it contains a character outside that set (Cyrillic, Arabic or CJK, for example), stops and lists the characters it cannot draw. Use an image watermark for those scripts.
- Long text runs off the page. Nothing shrinks the text to fit, so a long phrase at 100 pt will be cropped at the page edge. Lower the font size.
- Tiled mode on big files. It draws dozens of copies per page, so a long document grows in size.
- Not tamper-proof. The watermark is an ordinary object in the page, so someone with an editor can delete it.
- Page range. Untick "Apply to all pages" and use
1-3, 5to stamp only those pages.
For photos rather than PDFs, use Watermark Image.