Add Header and Footer to PDF
Operator: Abdulla Al Fahad. How tools are built and checked
Marking every page of a finished PDF usually means going back to the source document, if you still have it. This tool writes the line onto the PDF itself: one line of text in the top margin, one in the bottom margin, or both, on every page, with tokens that fill in the page number, the total page count and the date. Typing "Lease draft {date} - Page {page} of {pages}" in the footer of a 37-page lease gives "Lease draft 2026-11-12 - Page 37 of 37" on the last page and the right number on every page before it.
Odd and even pages can carry different text, which is what a document printed double-sided needs if the page number should sit on the outside edge of every spread, and the alignment, font size and distance from the edge can all be set.
Key features
- A header line, a footer line, or both, on every page.
- Tokens {page}, {pages} and {date}, with any other braces left untouched.
- Optional separate header and footer text for even pages.
- Left, centre or right alignment; font size 6 to 14 pt; margin 10 to 72 pt.
- Upright placement on rotated pages, with page size and existing content unchanged.
- A check that rejects characters Helvetica cannot draw, naming the character and its code point.
What changes between PDF and PDF with header and footer text
The text is drawn in Helvetica, one of the fourteen fonts every PDF reader is required to provide, so no font file is added to the document. The trade-off is the character set: those fonts use the WinAnsi encoding, which covers the Latin alphabet with the accented letters of most Western European languages, digits, common punctuation, curly quotes, the en and em dash and the euro sign. Characters outside it, such as the Polish Ł, Greek or Cyrillic letters, CJK text, arrows and emoji, cannot be drawn, and the tool stops with a message that names the first such character and its Unicode code point, for example "→" (U+2192), before changing any page.
Three tokens are replaced on each page: {page} with that page's position in the file (1, 2, 3…), {pages} with the total number of pages, and {date} with the date the file was processed, written as YYYY-MM-DD in your computer's local time so it reads the same in every country. Tokens are not case-sensitive. Anything else in curly braces, such as {client}, is left exactly as typed.
The margin setting, from 10 to 72 points (72 points is one inch, or 25.4 mm), is used three ways: a footer's baseline sits that far above the bottom edge, a header's baseline sits that far plus the font size below the top edge, and left- or right-aligned text starts or ends that far in from the side. Centred text is measured and centred exactly. All positions are taken from the visible page area, and pages stored with a rotation flag get their text along the edge the reader sees as the top or bottom.
How it works
Pressing the button starts with your text, not the pages: line breaks in your text are turned into spaces, and every field is checked against Helvetica's character set before any page is touched.
The tool then visits each page. It picks the odd or even pair of fields, replaces the tokens, measures the result in Helvetica at your size, refuses it if it is wider than the space between the side margins, works out the position from the page's visible box and rotation, and draws it. The document is saved with its original pages, sizes and content plus the new text, page 1 is rendered for the preview, and the download keeps the original name with -header-footer added.
Common use cases
- Putting "Confidential: settlement discussions" at the top of every page of a document sent to the other side in a dispute.
- Adding "Page 3 of 18" footers to a contract assembled from several PDFs, so signatories can see that no page is missing.
- Stamping "Draft {date}" on a report sent out for comments, so feedback on an old version is easy to spot.
- Giving a double-sided handbook outside-edge page numbers: right-aligned on odd pages, left-aligned on even pages.
- Labelling each page of a submission with a reference number and the applicant's name before it goes into a bundle.
How to use this tool
- Add one PDF by dropping it on the box or clicking to choose it.
- Type the header, the footer or both, using {page}, {pages} and {date} where you want them. The default footer is Page {page} of {pages}.
- Tick Different text on even pages if odd and even pages need different wording, and fill in the even-page fields.
- Set alignment, font size and margin, and read the sample to confirm what page 1 and page 2 will say.
- Press Add header and footer, check the rendered first page, then download the PDF.
Example
Source and settings
lease.pdf: 37 pages, A4 (595 × 842 pt)
Header: Confidential – not for circulation
Footer: Lease draft {date} - Page {page} of {pages}
Alignment: Centre Font size: 9 pt Margin: 28 pt
Processed on 12 November 2026Result
lease-header-footer.pdf: 37 pages, A4, 37 of 37 pages received text
Page 1 top: "Confidential – not for circulation" (126 pt wide, baseline 37 pt below top)
bottom: "Lease draft 2026-11-12 - Page 1 of 37" (baseline 28 pt above bottom)
Page 37 bottom: "Lease draft 2026-11-12 - Page 37 of 37" (157 pt wide)Tips for best results
- Check the sample under the settings before running. It expands your text for page 1 and page 2 of the loaded file, so a mistyped token such as {page s} shows up as literal text straight away.
- For outside-edge numbering in a printed book, tick Different text on even pages and put the number at the end of the odd-page footer and at the start of the even-page footer. One alignment applies to every page, so for numbers flush right on odd pages and flush left on even pages, run the file twice as the FAQ below describes.
- Leave a field empty to skip it. A header-only run, or a footer only on odd pages, is fine; pages whose fields are all empty are left untouched, and the result line reports how many pages received text.
- Lower the margin rather than the font size when the line needs to clear existing content. At 28 pt a 9 pt footer sits well inside the margin of a typical word-processed page, but documents with a printed letterhead band often need 14 to 18 pt to sit below it.
- Use a hyphen or an en dash as a separator. Both are in Helvetica's character set, as are the vertical bar and the middle dot (·); bullets from symbol fonts, box-drawing characters and arrows are not.
Edge cases to watch
The text is added on top of what the page already shows; nothing is erased or moved. On a page that already has a footer, or where the body text runs into the margin, the new line will overlap. Increase or reduce the margin to find clear space, or choose the other edge.
A line that is too wide for the page is refused rather than squeezed or wrapped. At 9 pt, "Lease draft 2026-11-12 - Page 37 of 37" measures 157 pt, comfortably inside the 539 pt available on an A4 page with 28 pt margins, but a long sentence at 14 pt can exceed it. The error names the page and both widths.
{page} counts the pages in this file, starting at 1. If the PDF is the second volume of a longer bundle that should continue from page 213, use Add Page Numbers, which has a first-number setting, or Bates numbering for legal sequences.
Only Helvetica is available, in dark grey, at 6 to 14 pt. There is no bold, colour choice or second line; text with a line break is joined into a single line with a space.
Header and footer text is real text in the content stream, so anyone with an editor can remove it again. It labels a document; it does not secure it.
Common errors and how to fix them
- The header contains "Ł" (U+0141), which Helvetica cannot draw.
- Helvetica only covers the WinAnsi character set. Replace the character (Ł with L, an arrow with ->, a check mark with a word) and run again. Accented letters such as é, ü and ñ are fine.
- The footer on page 1 is [width] pt wide, but only [space] pt fit between the side margins.
- Shorten the text, choose a smaller font size, or reduce the margin. The widths in the message tell you how much needs to go.
- A header and footer can only be written into a PDF that opens without a password. Remove the password with Unlock PDF first.
- Text cannot be added to an encrypted document. Remove the password with Unlock PDF, add the header and footer, and protect the result again if needed.
- "notes.docx" is not a PDF, so there are no pages to add a header or footer to.
- The tool checks the file's first bytes, not its name. Export the document to PDF first, then add the header and footer.
Best practices
- Run this as the last step after merging, reordering or deleting pages, so {page} and {pages} match the final document.
- Keep headers short. A document title or a confidentiality line reads better than a sentence, and short lines are less likely to collide with page content.
- Use {date} for drafts and leave it out of final versions, so a signed copy does not carry the date it happened to be stamped.
- Look at a page with the fullest margin content in the preview or after download, not just page 1, before sending the document on.
Headers, footers and page numbers: which tool to use
Add Page Numbers places a number in a fixed format in one of six corners and can start from any number or skip a cover. Bates numbering writes a legal sequence with a prefix and zero padding across several files. This tool is for free text: any wording you like, with the page number and count wherever they belong in the sentence, at the top and bottom at once and different on odd and even pages.
- A plain number in a corner, or numbering that continues from another file: Add Page Numbers.
- A legal production sequence such as ACME000123 across a set of files: Add Bates Numbers.
- A sentence, a confidentiality notice, a date or a reference on every page: this tool.
Why the character check exists
A standard PDF font has no glyphs for characters outside its encoding, so a viewer would show a blank, a box or the wrong letter where the character should be. Rather than produce a file that looks correct in the sample and wrong in print, the tool checks every character first and refuses the run if one cannot be drawn. Because the check happens before any page is changed, fixing the text and pressing the button again is all it takes.
Frequently asked questions
What date does {date} insert?
The date on your computer at the moment you press the button, in YYYY-MM-DD form, for example 2026-11-12. It is not the PDF's creation date and it does not update when the file is opened later.
Can I put the page number on the outside edge for double-sided printing?
Yes, partly in one run. Tick Different text on even pages and give odd and even pages their own footers. Alignment is shared, so for right-aligned odd pages and left-aligned even pages, run twice: once with only the odd fields filled and right alignment, then on the result with only the even fields filled and left alignment.
Will this cover up text near the edge of the page?
It can. The line is drawn on top of the page without a background, so anything already in that spot shows through. Adjust the margin or switch between header and footer to find clear space, and check the preview.
Does it change the page size or add a margin?
No. Pages keep their exact size and content; the text is drawn inside the existing page, in whatever margin it already has.
Can I use a different font or colour?
No. The tool uses Helvetica in dark grey so that nothing has to be embedded and the result looks the same in every viewer. That is also why it is limited to the WinAnsi character set.