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 | Provenance | Actions |
|---|---|---|---|---|
| pagelabels-1.1.0.tar.gz | 5.8 kB | Without provenance | Details for pagelabels-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pagelabels-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for pagelabels-1.1.0-py3-none-any.whl |
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
|
Security for pagelabels 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.