For page numbers of reports and books, it is common to use Roman numerals (i, ii, iii ...) in the table of contents and Arabic numerals (1, 2, 3 ...) starting from 1 in the main story. is.
However, that is not the case with the PDF version, and the pages of the PDF are often numbered with simple serial numbers. In that case, even if n pages are written in the table of contents, in the PDF version, the total number of pages in the table of contents m must be added to the (m + n) page.
To eliminate this inconvenience, I will show you how to assign page numbers similar to books to PDF.
To install pagelabes, run pip install pagelabels
.
python -m pagelabels --startpage 1 --type "roman lowercase" --outfile out.pdf in.pdf
python -m pagelabels --startpage 9 --type "arabic" out.pdf
startpage
: From what page of the entire PDF to start the page with this scheme.style
: The style of numbers. ʻArabicArabic numerals (1, 2, 3, ...),
roman uppercase uppercase Roman numerals (I, II, III, ...),
roman lowercaselowercase Roman numerals (i, ii,, iii, iii),
letters uppercase uppercase letters (A, B, ..., Z, AA, BB, ...),
letters lowercase` lowercase letters (a, b, ..., z, aa, bb, bb, ...)prefix
: A string that precedes the page number. "page-" or something.firstpagenum
: The first number of page numbers to allocate. If not specified, page numbers will be assigned from 1.