Add page numbers to a PDF by API: Page 1 of 9
Number the pages of a PDF with one API call. Formats with {{n}} and {{total}}, eight positions, size and color, plus how to number merged documents correctly.
Page numbers matter as soon as a PDF is printed, reviewed or referenced in a call. Generated documents often lack them, and merged packs restart them at every file. The PDF Page Numbers API writes one consistent sequence across the whole file.
curl https://api.justapi.tech/v1/pdf/page-numbers \
-H "Authorization: Bearer ak_live_..." \
-H "Content-Type: application/json" \
-d '{"source": {"url": "https://files.example.com/pack.pdf"}, "options": {"format": "Page {{n}} of {{total}}", "position": "bottom-right"}}'
Format
format is any text with {n} for the page number and {total} for the page count:
{n}gives3Page {n}givesPage 3{n} / {total}gives3 / 12Sheet {n} of {total}givesSheet 3 of 12
Position and style
position:top-left,top-center,top-right,middle-left,middle-right,bottom-left,bottom-center(the default) orbottom-right.font_sizefrom 4 to 72; the default is 10.colorin hex; the default is black.marginin points from the edge; the default is 28, about 1 cm.boldtrue or false.
Numbers are vector text, placed relative to how each page is shown, so they land in the right corner on landscape and rotated pages too.
Number a merged pack
Merging three PDFs keeps each file's own numbers printed on the pages, if they had any. Number after merging: call the PDF Merge API, then pass its result.file_id as the source of the page numbers call. The new sequence runs across the whole pack. If the source files already show numbers, choose a different corner so the two do not overlap.
Skip the cover
Use pages to number only some pages, and start_at to choose the first number. There is a full walkthrough in page numbers that skip the cover page.
Cost
$0.005 per call at the first tier, whatever the page count. Signed PDFs are refused with signed_pdf, at no charge.
The free page numbering tool lets you try a format and position on one file.