PDF page labels
Give the whole document a numbering style: i, ii, iii or A, B, C instead of 1, 2, 3.
Runs on your device. The file is never uploaded.
PDF page labels writes a /PageLabels number tree into the document catalog, so your reader's page box shows iii where it showed 3. Pick one of five styles, a start of 1 or more, and an optional prefix. The tree is a single run from page one, replacing any label scheme the file already had.
Questions
What does this change in the file?
The /PageLabels number tree in the document catalog, written directly, since pdf-lib has no high-level API for it. Nothing is drawn on any page. What changes is the label your reader shows in its page number box and beside its thumbnails, so page 3 can read iii or C instead.
Which numbering styles can I pick?
Five: decimal, lower-roman, upper-roman, upper-alpha and lower-alpha, mapping to the PDF spec's D, r, R, A and a. Decimal is the default. There is no option for no label at all, and no way to mix styles: one style covers the whole document.
Can I have roman numerals for the front matter and decimal for the body?
Not with this tool. It writes a single run starting at page 1 that covers everything. A style-per-range scheme is a real PDF feature, but it is a bigger tool than this one, so it was left out rather than half-built. You would need a full PDF editor for that.
What does the prefix do?
It puts a fixed string in front of every label, so a prefix of Draft- with decimal style gives Draft-1, Draft-2 and so on. Leave it blank and no prefix entry is written into the file at all. The prefix is stored once for the whole document, not per page.
Why was my start value rejected?
Because it has to be a whole number of 1 or more, and it says so: "start must be a whole number of 1 or more". Zero and negative starts are refused because the PDF page label counter is defined as starting at one or higher. The start applies to the first page and the labels count up from there.
Will the labels show up when I print?
No. Nothing is added to the page content, so a printed sheet looks exactly as it did before. Labels live in the document structure and are for on-screen navigation. If you want numbers on the paper, use Add page numbers, which draws them at the bottom of each page.