Skip to main content

Python library to manipulate PDF page numbers and labels.

Project description

pagelabels python library

This is a little library, based on pdfrw, that helps manipulate PDF page labels in python. It can parse page labels from a PDF, edit page labels, and write them in a PDF.

For more info about page labels, see:



Inherits from list and represents a list of PageLabelSchemes.


Static method. Read page labels from a PdfReader object.


Write the page labels to a PdfReader object.


Inherits from a named tuple with fields:

  • startpage : Index in the PDF where to start numbering pages according to this scheme
  • style : one of the strings arabic, roman uppercase, letters uppercase, roman lowercase, letters lowercase
  • prefix : string to prepend to all page labels
  • firstpagenum : where to start the index


from pdfrw import PdfReader, PdfWriter

from pagelabels import PageLabels, PageLabelScheme

reader = PdfReader("input.pdf")
labels = PageLabels.from_pdf(reader)
newlabel = PageLabelScheme(startpage=3, # the index of the page of the PDF where the labels will start
                           style="roman", # See options in PageLabelScheme.styles()
                           prefix="Appendix ",
                           firstpagenum=1) # number to attribute to the first page of this index
labels.append(newlabel) # Adding our page labels to the existing ones
writer = PdfWriter()
writer.trailer = reader

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pagelabels-1.2.0.tar.gz (6.1 kB view hashes)

Uploaded source

Built Distribution

pagelabels-1.2.0-py3-none-any.whl (17.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page