pagelabels


Namepagelabels JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://github.com/lovasoa/pagelabels-py
SummaryPython library to manipulate PDF page numbers and labels.
upload_time2024-08-03 11:42:13
maintainerNone
docs_urlNone
authorOphir LOJKINE
requires_pythonNone
licenseNone
keywords pdf page labels page numbers title page
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](#pagelabels)
 * [PageLabelScheme](#pagelabelscheme)

## PageLabels
Inherits from list and represents a list of `PageLabelScheme`s.

### 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 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

## Example

```python
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")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lovasoa/pagelabels-py",
    "name": "pagelabels",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pdf, page labels, page numbers, title page",
    "author": "Ophir LOJKINE",
    "author_email": "pere.jobs@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ae/45/e6ee83581c78213e8ccd16a8324b97dfb4c420f0ffad9bddc348d233ad9f/pagelabels-1.2.1.tar.gz",
    "platform": null,
    "description": "# pagelabels python library\n\nThis is a little library, based on **pdfrw**, that helps manipulate PDF page labels in python.\nIt can parse page labels from  a PDF, edit page labels, and write them in a PDF.\n\nFor more info about page labels, see: https://www.w3.org/TR/WCAG20-TECHS/PDF17.html\n\n## Classes\n * [PageLabels](#pagelabels)\n * [PageLabelScheme](#pagelabelscheme)\n\n## PageLabels\nInherits from list and represents a list of `PageLabelScheme`s.\n\n### PageLabels.from_pdf(pdfrwobj)\nStatic method.\nRead page labels from a PdfReader object.\n\n### .write(pdfrwobj)\nWrite the page labels to a PdfReader object.\n\n## PageLabelScheme\nInherits from a named tuple with fields:\n * `startpage` : Index in the PDF where to start numbering pages according to this scheme\n * `style` : one of the strings `arabic`, `roman uppercase`, `letters uppercase`, `roman lowercase`, `letters lowercase`\n * `prefix` : string to prepend to all page labels\n * `firstpagenum` : where to start the index\n\n## Example\n\n```python\nfrom pdfrw import PdfReader, PdfWriter\n\nfrom pagelabels import PageLabels, PageLabelScheme\n\nreader = PdfReader(\"input.pdf\")\nlabels = PageLabels.from_pdf(reader)\nnewlabel = PageLabelScheme(startpage=3, # the index of the page of the PDF where the labels will start\n                           style=\"roman\", # See options in PageLabelScheme.styles()\n                           prefix=\"Appendix \",\n                           firstpagenum=1) # number to attribute to the first page of this index\nlabels.append(newlabel) # Adding our page labels to the existing ones\nlabels.write(reader)\nwriter = PdfWriter()\nwriter.trailer = reader\nwriter.write(\"output.pdf\")\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library to manipulate PDF page numbers and labels.",
    "version": "1.2.1",
    "project_urls": {
        "Homepage": "https://github.com/lovasoa/pagelabels-py"
    },
    "split_keywords": [
        "pdf",
        " page labels",
        " page numbers",
        " title page"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7f5e8d76c43f0a427aee4fb66de11c46529538cac72724058bd6428d18bbc316",
                "md5": "87e628755aa31c73fa5536c06020b54e",
                "sha256": "522401e42c5cd4bec29e2a75a859015053b0691be60d9f97be4faa7ffb4970e4"
            },
            "downloads": -1,
            "filename": "pagelabels-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "87e628755aa31c73fa5536c06020b54e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17621,
            "upload_time": "2024-08-03T11:42:11",
            "upload_time_iso_8601": "2024-08-03T11:42:11.658137Z",
            "url": "https://files.pythonhosted.org/packages/7f/5e/8d76c43f0a427aee4fb66de11c46529538cac72724058bd6428d18bbc316/pagelabels-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ae45e6ee83581c78213e8ccd16a8324b97dfb4c420f0ffad9bddc348d233ad9f",
                "md5": "d856338491681b09c5f945d9fc193c50",
                "sha256": "180132844093a0a9c8581c6761348eb18299063979d1bffcda667af22f08dae8"
            },
            "downloads": -1,
            "filename": "pagelabels-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d856338491681b09c5f945d9fc193c50",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 18433,
            "upload_time": "2024-08-03T11:42:13",
            "upload_time_iso_8601": "2024-08-03T11:42:13.012427Z",
            "url": "https://files.pythonhosted.org/packages/ae/45/e6ee83581c78213e8ccd16a8324b97dfb4c420f0ffad9bddc348d233ad9f/pagelabels-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-03 11:42:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lovasoa",
    "github_project": "pagelabels-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pagelabels"
}
        
Elapsed time: 0.33980s