What a header and footer are for
A header is the line of text at the top of each page; a footer is the line at the bottom. Offices use them to repeat what a reader needs on every sheet: the company or project name, the document title and version, the date it was issued, a notice such as "Confidential" or "Draft", and the page count. When a printed report is split up or a single page is forwarded, the header and footer still say where it came from.
Six positions and the codes
Each line has three boxes: left, centre and right, so a typical footer can show the file name on the left, "Page {page} of {total}" in the middle and the date on the right. Codes are replaced on each page: {page} is the page number in the file, {total} the number of pages in the file, {date} the date you type under the boxes (today by default, in any format you like), {filename} the name of the PDF without .pdf, and {bates} the Bates number. Text that is too wide for its place is printed smaller so it never runs off the page, and the result tells you when that happened.
Bates numbering
Bates numbering gives every page of a set of documents its own identifier, such as ABC000001, ABC000002 and so on. Law firms, courts, auditors and procurement teams use it to refer to an exact page in a large bundle. Here you choose a prefix (a case or client code), an optional suffix, how many digits the number has (zeros are added in front), the first number and where it is printed. To continue a series across several files, start the next file at the number after the last one shown in the result. Only the pages you chose are counted, so a skipped cover does not use a number.
Header and footer or page numbers?
If all you need is a page number, Add page numbers to PDF is quicker: pick a position and a format and you are done, with a free choice of the first number. This tool is for everything around the page number: titles, dates, notices, file names, several texts on one line and Bates identifiers. {page} here is always the page's place in the file, so the cover is page 1 even when it is skipped.
Arabic text, page ranges and rotated pages
Arabic headers are written with an embedded Unicode font (DejaVu Sans), with the letters joined and the line laid out right to left, so the text can be selected, copied and found with search like any other text in the PDF. Numbers and English words inside an Arabic line keep their own order. The font is downloaded from this site only when the text needs it, and only the letters you use are stored in the PDF. Pages shown sideways or upside down get the text upright at the top and bottom of the page as you see it, and pages of different sizes each get it in the same relative place.
Private by design
The PDF is opened and changed in your browser with pdf-lib, and the preview is drawn with pdf.js. No copy is sent to a server, so contracts, court bundles and HR files stay on your device. The rest of each page is kept as it is: the header and footer are added on top, at the margins you set, so check the preview if your pages already have printing close to the edge. Password-protected PDFs need to be unlocked first.