Skip to content

Instantly share code, notes, and snippets.

@stefanschmidt
Created June 20, 2023 11:22
Show Gist options
  • Save stefanschmidt/63fdd9f86a35f14d86c02cc321b59ca7 to your computer and use it in GitHub Desktop.
Save stefanschmidt/63fdd9f86a35f14d86c02cc321b59ca7 to your computer and use it in GitHub Desktop.
Fix logical page numbering of a PDF document
# cover (1 page)
# table of contents (14 pages)
# result: C1,i,ii,...,xiv,1,2,...
pip install pagelabels
python -m pagelabels --delete doc.pdf
python -m pagelabels --startpage 1 --prefix C doc.pdf
python -m pagelabels --startpage 2 --type 'roman lowercase' doc.pdf
python -m pagelabels --startpage 16 --type arabic doc.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment