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: https://www.w3.org/TR/WCAG20-TECHS/PDF17.html
Classes
PageLabels
Inherits from list and represents a list of PageLabelSchemes.
PageLabels.from_pdf(pdfrwobj)
Static method. Read page labels from a PdfReader object.
.write(pdfrwobj)
Write the page labels to a PdfReader object.
PageLabelScheme
Inherits from a named tuple with fields:
startpage: Index in the PDF where to start numbering pages according to this schemestyle: one of the stringsarabic,roman uppercase,letters uppercase,roman lowercase,letters lowercaseprefix: string to prepend to all page labelsfirstpagenum: where to start the index
Example
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
labels.write(reader)
writer = PdfWriter()
writer.trailer = reader
writer.write("output.pdf")
Metadata
Release files for pagelabels 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pagelabels-1.1.0.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pagelabels-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.4 kB
Release files / pagelabels-1.1.0.tar.gz
| Download URL | pagelabels-1.1.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88ba2ebc6a783a0310eb0628baaafde4826c8a855568560190652551af6356b6
|
|
BLAKE2b-256 checksum How to use checksums |
0bd5e8ea1e33b6ba9ac5cc530a964cef692124994ced872eb3264dbb22c70fd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.4
|
Release files / pagelabels-1.1.0-py3-none-any.whl
| Download URL | pagelabels-1.1.0-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd071683477681c6953f21cd05685a061ff99a44f84858f5d564bc41b590b00d
|
|
BLAKE2b-256 checksum How to use checksums |
fa8c79480331bb304b4a7ea3ca1df9172487afcb07eb455351d5b57eec489baf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.4
|