Watermarks on rotated and odd-sized PDF pages
Why some tools put watermarks sideways or off the page on landscape and rotated PDFs, and how the JustAPI watermark places the mark the right way up on every page.
Watermark a mixed PDF, with portrait pages, a landscape spreadsheet and a scanned page stored sideways, and many tools get some pages wrong. The mark runs up the side of the landscape page, or sits half off a small page. The cause is the same in every case.
Two kinds of "landscape"
A PDF page can look landscape in two ways:
- A wide page. The page box is wider than it is tall.
- A rotated page. The page box is tall, but it carries a
/Rotateof 90 or 270, so the viewer turns it.
Both look the same on screen. But a tool that draws the watermark in the page's own coordinates, without reading /Rotate, places it as if the page were upright. On a rotated page, the viewer then turns the mark along with everything else, and it ends up sideways.
Odd sizes
A mark sized for A4 is too big for a receipt page and too small for an A3 drawing. A fixed font size, or a position measured from a fixed corner, works on one size and fails on the rest.
How the JustAPI watermark handles it
The PDF Watermark API works out how each page is shown before it draws:
- It reads the visible area of the page and its rotation.
- It places the mark in that visible frame, so
top-rightmeans the top right as the reader sees it. - It scales the text to each page unless you set
font_size, so a receipt page and an A3 page both get a mark that fits. - The angle is measured as the reader sees the page, so 45 degrees looks like 45 degrees on every page.
How to check a tool
Make a test PDF with a portrait page, a wide page, and a page with /Rotate 90. Watermark it with position: top-right and rotation: 0. The text should read left to right, in the top right corner, on all three.
When you need a fixed size
For a footer-style mark, like a client name in small print, set font_size (say 9) and position: bottom-center. The same size then appears on every page, positioned from the visible bottom edge.
Try the free PDF watermark tool on a mixed file and compare.