How content stacks inside a PDF, and why 'behind' isn't a layer
A PDF page has no layers panel. It has a painting order, and whatever is drawn last wins. That single fact explains what overlaying one PDF on another can and can't do.
In an image editor, stacking is a panel on the right. Drag the logo above the photo, it covers the photo. Drag it below, it hides behind. The layers are objects you can reorder for as long as the file exists.
A PDF page has none of that. It has a set of drawing instructions that a reader executes from the first to the last, and paint applied later covers paint applied earlier. That’s the entire stacking model. Once you know it, everything about putting one PDF over another — including the part where “behind” is oddly hard to find in most tools — stops being mysterious.
The Overlay two PDFs tool leans on exactly this behaviour, so it’s a decent excuse to look at what the format is actually doing.
A page is a program, and it runs once
The content of a page is a stream of operators: move here, set this colour, draw this path, fill it, show this text, paint this embedded object. The reader runs them in sequence. There’s no z-index, no ordering property, nothing that says “this element belongs on top”. Position in the sequence is the ordering.
Which means the question “how do I put my logo behind the text?” has exactly one answer: get your logo’s instructions to run before the text’s instructions.
The list nobody talks about
Here’s the part that makes it workable. A page’s content doesn’t have to be one stream. The /Contents entry can be an array of streams, and a reader is required to treat them as if they were concatenated into one — the joins between them are just whitespace as far as the operators are concerned.
That array is a seam you can use. Add a new stream that paints your overlay, then move it to the front of the array. The overlay gets painted first. The original content, untouched, runs afterwards and lands on top of it. Nothing about the base page was decoded, edited or re-encoded. The bytes of the original content stream are the same bytes they were before, just no longer first in the queue.
Libraries that draw onto pages tend to append, because appending is what you want nearly every time. Getting behind means appending and then reordering — a small move, but one most tools never bothered to make, which is why “put this underneath” is a rare option.
The alternative, and why it’s worse
There’s an obvious way to get something behind your content without touching painting order: make a brand new page, draw the letterhead, then embed the original page on top as an image-like object.
It looks identical and it costs you the document. Embedding a page collapses it into a graphic. The links stop being links. Annotations and comments go. Form fields become a picture of form fields — the same outcome as flattening a PDF, except you didn’t ask for it. Bookmarks pointing into the document lose their targets.
Modifying the base document in place avoids all of that, because the base document is still the document. It keeps its page tree, its annotations, its AcroForm dictionary. If it was a fillable form before, it’s still a fillable form after, now with stationery underneath.
The limit you can’t engineer around
Painting order cuts both ways. If the base page begins by filling a white rectangle across the whole page — which is what virtually every scanner-produced PDF does — then your overlay, sitting first in the queue, gets painted and immediately covered by that rectangle.
There is no fix. The page is genuinely painting over your content, and the only way to prevent it would be to rewrite the base page’s instructions, which is the thing we refused to do on the previous point. So: behind works beautifully on born-digital documents that don’t paint their own background, and does nothing visible on scans. Put the overlay on top for those.
Opacity is a group operation, or it should be
Draw a semi-transparent stamp made of several overlapping shapes and you can end up with a mess: each shape composited separately, so wherever two of them overlap the result is darker. Nobody wants a stamp with a dark seam down the middle of every letter.
The format has an answer — mark the embedded object as a transparency group, and it gets composited as a single unit before the alpha is applied. The overlay behaves like one flat sticker at 30%, which is what people picture when they set opacity to 30%. That’s how the tool handles anything below full opacity, and it’s a detail worth knowing about because it’s a common source of “why does my watermark look blotchy”.
One embed, many pages
When the same sheet repeats across every page — the letterhead case — the overlay is embedded once as a reusable object and referenced from each page. Three hundred references to one object, not three hundred copies. A 200 KB letterhead on a 300-page document adds about 200 KB.
That’s not an optimisation someone bolted on; it’s what the object model is for. Fonts, images and embedded pages all work this way.
What it still isn’t
Worth being blunt about the ceiling here.
This isn’t real layers. PDF does have a genuine layers feature — optional content groups, the thing that gives you checkboxes in a viewer’s Layers panel to show and hide parts of a drawing. That’s a different mechanism, mostly used by CAD exports and print workflows, and stacking an overlay doesn’t create one. The overlay isn’t switchable off later.
The text doesn’t merge. Base text and overlay text remain two separate runs of content. Both are selectable, but a sentence that visually spans both is not one sentence to a text extractor.
Geometry is decided at paste time. The overlay is placed against the page’s visible box (the crop box, which doesn’t always start at 0,0), scaled down if it’s too big for the page, never scaled up, and anchored to the centre or a corner. Base pages never change size. And rotation declared on the overlay’s own pages isn’t honoured — its box is embedded unrotated, so rotate the overlay before you use it.
Once you stop thinking of a PDF page as a stack of objects and start thinking of it as a script that runs top to bottom, the behaviour of every stamping, watermarking and letterhead tool you’ve ever used makes sense — including the ones that quietly flattened your form.