Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. PDF Tools
  3. PDF Header/Footer Adder
Add to favorites

PDF Header/Footer Adder

Running heads and page numbers, placed where the page really is

PDFs never leave your deviceMore pdf toolsJump to full guide

Related reading

  • PDF Accessibility: Making Documents Everyone Can Read12 min read

Initializing in your browser…

You might also like

PDF Watermark Adder

Stamp a mark where the page really is, anchored or tiled

PDF Page Remover

Drop pages from a PDF, or keep only the ones you choose

PDF to Images

Render PDF pages at a resolution you set in dpi

PDF Header/Footer Adder: a worked example

A report of mixed paper sizes needs a dated header and page numbers, and some of its pages are cropped.

Input

report.pdf · header "{isodate}" · footer "Page {page} of {total}" · 36pt margin
What PDF Header/Footer Adder produces

Output

2026-09-06 at the top and "Page 3 of 12" at the bottom of every page, each exactly 36 points from the edge the reader sees

Every token is substituted in the FILE and not only in the preview, from one table both of them read. The margin is measured from the edge of what the page SHOWS, which is the CropBox clipped to the MediaBox, so a cropped page keeps its header where it can be seen rather than 40 points above the visible area, and it is the same distance on Letter, A4 and A5 alike. The edge is mapped through the page's own /Rotate, so a sideways scan gets its header across the top the reader sees.

About the PDF Header/Footer Adder

Add running heads, footers and page numbers to a PDF. Type the text or take a preset, choose left, centre or right for each, and set the size, the font, the colour and how far in from the edge they sit. Eight tokens are substituted per page, in the file and not just on screen: {page}, {total}, {pageof}, {date}, {isodate}, {time}, {year} and {filename}. The preview is a render of the actual page with the resolved lines drawn on it, at the positions the file will hold. The lines are measured from the edge of what the page SHOWS rather than from the paper, and mapped through the page's own rotation, so a cropped page, an offset box and a sideways scan all get their header where a reader will find it.

Working with your PDF

  1. 1Upload the PDF. The first page is rendered so you can see what you are doing.
  2. 2Take a preset, or type the header and footer text. Press "Tokens you can use" to insert {page}, {total}, {isodate} and the rest.
  3. 3Choose the alignment for each line, then the size, the font, the colour and the distance from the edge.
  4. 4Check the preview: it shows the resolved text at the position the file will hold it.
  5. 5Optionally name the pages to change; leave the box empty for all of them. Then add the lines and download.

Key features

  • Eight tokens substituted in the FILE as well as the preview: {page}, {total}, {pageof}, {date}, {isodate}, {time}, {year} and {filename}
  • A preview that is a render of the real page with the resolved lines on it
  • Separate text, alignment and position for the header and the footer
  • Six standard fonts, any hex colour and sizes from 6 to 24 points, all of which reach the file
  • Margins measured from the edge of what the page shows, so a cropped page keeps its header visible
  • Each line mapped through the page's own /Rotate, so the top is the top the reader sees
  • The same distance from the edge on every paper size in a mixed document
  • A page range, with {page} still counting from the start of the document
  • A token the tool does not know is named before it is printed onto every page

Common scenarios

  • Page numbering

    Add "Page 3 of 12" footers to a long document. Do it after merging, so the numbers match the joined file.

  • Running heads

    Put the document title or the file name in the header of every page, which is what many submission guidelines ask for.

  • Dated drafts

    Stamp the date and time a draft was produced, so two printouts of the same document can be told apart.

  • Legal and compliance

    Add a required reference number or disclaimer to every page of a contract or filing.

Tips & best practices

  • {page} counts from the start of the document, not from the start of your page range. Numbering pages 4 to 6 of a six page file gives 4, 5 and 6, which is almost always what you want.
  • Use {isodate} rather than {date} if the document will be read anywhere else. {date} follows the browser's locale, so 9/6/2026 means different days on different machines.
  • The margin is measured from the edge of what the page shows. If your document already has content near the edge, raise it: the lines are drawn on top and do not push existing content out of the way.
  • Leave one field empty to add only a header or only a footer.
  • Add page numbers AFTER merging documents, not before. Numbers written into the parts are wrong as soon as the parts are joined.
  • The preview shows the resolved text, not the tokens, because it is built from the same substitution the file gets.

Examples

  • Page numbers on a mixed-paper document

    A file of Letter, A4, Letter landscape and A5 pages gets its footer exactly 34 points from the bottom of every one, because the margin is a length measured from the visible edge rather than a fraction of the page.

  • A header on a cropped page

    On a page cropped to [72, 72, 540, 720] the header lands at y 675 to 684, inside what the reader sees. Measured from the paper instead it would sit at 760, which the viewer never shows.

  • A date that is really a date

    The "Date and pages" preset writes 2026-09-06 into the file. The shipped version wrote the eight characters "{isodate}" onto every page and showed the real date only in the preview.

How it works

A header is a mark anchored to the top edge and a footer one anchored to the bottom, so this tool and the watermark adder share their placement arithmetic. Three things decide whether either lands where you asked.

The first is that the edge of the page is the edge of what the page SHOWS. A page can carry a CropBox, in which case a viewer shows only the intersection of that box with the MediaBox (ISO 32000-1 clause 14.11.2), and a MediaBox does not have to start at the origin. Measuring from the paper instead puts a header where nobody can see it: on a Letter page cropped to [72, 72, 540, 720], a header written 30 points below the top of the MediaBox lands 40 points ABOVE anything the reader is looking at, and the matching footer lands 54 points below it.

The second is the /Rotate entry, which turns a page clockwise when it is displayed. pdf-lib draws in raw page space and applies none of it, so a line written at "the top" of a page carrying /Rotate 90 comes out down the side, sideways. Here the edge is mapped back through the page's own rotation and the text is turned with it, which matters for any scan whose pages are not all the same way up.

The third is the distance from the edge, which has to be a real length rather than a constant. A fixed inset is a different proportion of every paper size, so a document mixing Letter, A4 and A5 gets visually inconsistent margins. The margin here is set in points and measured from the edge of the visible area, so it is the same distance on every page whatever the paper.

Eight tokens are substituted, and they are substituted in the FILE and not only in the preview: {page}, {total}, {pageof}, {date}, {isodate}, {time}, {year} and {filename}. One table is read by both the preview and the writer, so the two cannot drift apart. A token the tool does not know is named before you press anything, rather than being printed onto every page of the document.

One limitation is stated rather than hidden. The standard PDF fonts are single byte and can only draw what WinAnsiEncoding names, so Cyrillic, Greek and CJK text cannot be drawn; the tool checks your text against the same table the embedder uses and says which characters are the problem.

Frequently asked questions

Can I add a header without a footer, or the other way round?

Yes. Leave either field empty and only the one you fill in is added. With both empty nothing runs.

Will the header overlap my existing content?

It can. The lines are drawn on top of the page and nothing is moved out of the way, so a document whose text already reaches the edge may need a larger margin. The preview shows exactly where the text will land, on a render of your own page.

Which tokens are substituted?

{page}, {total}, {pageof}, {date}, {isodate}, {time}, {year} and {filename}, and all of them are substituted in the downloaded file as well as in the preview. A token the tool does not recognise is named on the page before you press anything.

Does the colour and font choice reach the file?

Yes. Six standard PDF fonts and any hex colour are written into the document itself.

If I number only some pages, what does {page} say?

It says the page's number in the whole document. Numbering pages 4 to 6 of a six page file gives 4, 5 and 6, not 1, 2 and 3.

What happens on a page that is cropped or rotated?

Both are handled. The margin is measured from the edge of the area the page actually shows, and the edge you pick is mapped through the page's own /Rotate, so a sideways scan gets its header across the top as the reader sees it, the right way up.

Why will it not accept Cyrillic or Japanese text?

The fourteen standard PDF fonts are single byte and can only draw what WinAnsiEncoding names, which is Latin script plus a set of symbols. The tool checks your text against that table and names the characters it cannot draw.

Related tools and how they differ

  • PDF Watermark Adder: The same placement arithmetic aimed at the middle of the page, with tiling and an angle; use it for a diagonal stamp rather than a running head.
  • PDF Merger: Merge first, then number. Page numbers added before a merge are wrong the moment the documents are joined.

Further reading

  • PDF Accessibility: Making Documents Everyone Can Read12 min read

Private by design

PDF parsing and editing happen in your browser. Documents, and everything inside them, are never uploaded or stored remotely.