Add a Header and Footer to a PDF

Put a header and footer on every page of a PDF. Six slots, page numbers that count themselves, and the date or file name dropped in wherever you want them. Everything lands on a real page of your own document before you build anything, and nothing is uploaded.

  • Nothing uploaded
  • Works with no signal
  • No sign up
  • Quality unchanged
Drop a PDF here or click to choose one. Every page is shown so you can see how it reads.

Nothing loaded yet.

The pages

Load a PDF to see its pages.

Your PDF never leaves this device.The file is opened by your browser, the finished document is built here in the page, and the download comes from your own machine. The file you dropped in is not modified.

1Drop the PDF inEvery page is shown as it will look.
2Fill the slotsType into any of the six, with a live preview.
3Build and downloadAssembled here and saved from your own browser.

A token can be longer than it looks

A template like {file} takes up four characters while you are typing it and then resolves to a filename seventy characters long. Left alone it runs off the edge of the page or straight through the slot next to it. Every slot is measured after the tokens are resolved, and anything too long is trimmed to fit with an ellipsis.

How to use this tool

Drop a PDF on the box at the top. There are six slots, three across the header and three across the footer. Type into any of them and leave the rest empty.

The buttons under the slots drop a token into whichever one you last touched, so you do not have to remember the syntax. Every page redraws as you type.

A token can be much longer than it looks

This is the part that quietly breaks other tools, and it is worth understanding before you use any of them.

The file name token is six characters while you are typing it. On a real document it might resolve to something like site inspection report revision C for issue.pdf, which is seventy characters and far wider than the third of a page it has been given.

Left alone that runs off the edge of the paper, or worse, straight through whatever sits in the middle slot, so two pieces of text overlap and neither can be read. Every slot here is measured after its tokens have been resolved, and anything too wide is trimmed with an ellipsis.

A long file name overrunning its slot by 95 points, beside the same name trimmed with an ellipsis to fit
Measured after the token resolves, then trimmed, so it never runs into the next slot.

You will see the count of trimmed slots in the summary, so if something has been cut you know about it before building rather than afterwards.

Numbering that does not start at one

A report with a cover sheet should usually have a 1 on its second page, not its first. Set the first page number to zero and the cover becomes page zero, which you can then leave unmarked by setting the page range to start at two.

Roman numerals are there for front matter, and they are the other thing implementations get wrong. Four is iv rather than iiii, nine is ix, and nineteen ninety is mcmxc. All of them are checked.

A worked check you can repeat

Put Page then the n of total token in the footer centre of a three page document. The pages read Page 1 of 3, Page 2 of 3 and Page 3 of 3, and the summary reports three pages carrying it.

Now fill all six slots at once on a single page. The left slot starts at the margin, the right slot ends at it, the centre sits in the middle, and the header band sits above the footer band. Nothing overlaps.

Then put the file name token in a header slot on a document with a very long name. The summary reports a trimmed slot, and the text ends in an ellipsis inside the margin rather than running past it.

The layout was checked against an independent implementation before publishing: forty eight hand written cases covering every token, all the subtractive roman numerals, letter sequences past z into aa, numbering that starts anywhere, page selections, rotated pages and the six slots together. Then forty thousand generated cases across six paper sizes and all four page rotations, which produced nearly two hundred thousand trims and confirmed that not one piece of text ever left the printable area. Eight thousand of those were repeated against the copy running here in the browser.

Mistakes that catch people out

Putting the file name in the centre slot. It is the slot most likely to collide with its neighbours. Left or right is safer for anything long.

Forgetting the cover page. If page one should not be numbered, set the page range to start at two rather than trying to fix it afterwards.

Using twelve point on a busy drawing. Nine is usually right for a header. Larger starts competing with the content.

Expecting existing headers to be replaced. This adds to the page. If the document already has a footer you will end up with two.

Assuming a password protected file will open. It will not. Remove the protection first, in software that has the password.

Common questions

Is my PDF uploaded anywhere?

No. The file is opened by your browser, the finished document is built here on the page, and the download comes from your machine. Nothing crosses the network.

What are the tokens?

Short codes that resolve to something different on each page. Use braces around n for the page number, total for the page count, file for the file name, and date for today.

Can the first page be numbered something other than one?

Yes. Set first page is number to whatever you need. Use zero when there is a cover page that should not count.

What happens if my text is too long?

It is trimmed with an ellipsis so it fits its third of the page. Without that a long file name would run off the edge or straight through the slot next to it.

Does it work on landscape pages?

Yes, and on pages that carry their own rotation. Each page is measured as the reader sees it, so the footer sits along the edge that looks like the bottom.

Is the header real text?

Yes. It is drawn as text rather than as a picture, so it is searchable and selectable like the rest of the document.

Related PDF tools and reference

Reference: ISO 32000, the standard that defines page content and the rotation value used here.