Skip to main content

pypdfbox

pypdfbox

Apache PDFBox, in pure Python.
Split, merge, extract, render, fill forms, sign, encrypt —
no JVM, no native binaries, Apache-2.0 throughout.

PyPI Python Downloads License


uv add pypdfbox          # or: pip install pypdfbox
from pypdfbox import PDDocument
from pypdfbox.text import PDFTextStripper

with PDDocument.load("input.pdf") as doc:
    print(f"{doc.get_number_of_pages()} pages")
    text = PDFTextStripper().get_text(doc)

    doc.get_document_information().set_title("Annual Report")
    doc.save("output.pdf")

Why pypdfbox

One library, whole job Parse, edit, render, sign, extract, create. Not four partial ones.
Permissive, and enforced Every runtime dependency is Apache/MIT/BSD-family. Two automated gates block copyleft — a dependency allow-list, and a scan that reads the bytes of compiled wheels to catch statically linked copyleft that package metadata hides. Safe to embed in closed-source products.
No environment friction Pure Python plus wheels. Same behaviour in a container, a CI runner, or a sandbox.
A familiar API A Python-native port of Apache PDFBox 3.0.x — same class names, same object model, same behaviour, with Java camelCase mapped to snake_case. PDFBox answers usually translate directly.

Requires CPython 3.14+ (tested on 3.14 and 3.15). Wheels cover macOS (x86_64 + arm64), Linux/glibc (x86_64 + aarch64), and Windows (x86_64).

Command line

Installing the package puts a pypdfbox command on your PATH. Use pypdfbox <command> --help for all options.

uv tool install pypdfbox    # or: pipx install pypdfbox — CLI only, isolated
Command Does
pypdfbox split -i input.pdf one file per page (-split N for N-page chunks)
pypdfbox merge -i a.pdf b.pdf -o output.pdf concatenate, carrying bookmarks, forms and links
pypdfbox extracttext -i input.pdf text to input.txt (-console, -html, -md, -sort)
pypdfbox info input.pdf pages, version, encryption, metadata (-output json)
pypdfbox encrypt -i input.pdf -o output.pdf -O pass password-protect (-can* flags tune permissions)
pypdfbox decrypt -i input.pdf -o output.pdf -password pass remove protection
pypdfbox imagetopdf -i a.png b.png -o output.pdf one page per image
pypdfbox texttopdf -i notes.txt -o output.pdf plain text in, paginated PDF out
python -m pypdfbox.tools.pdf_to_image -i input.pdf -dpi 150 pages to images
python -m pypdfbox.tools.extract_images -i input.pdf pull out embedded images

Also: listbookmarks, pdfdebugger (interactive structure viewer), writedecodedstream, version. Full reference: CLI guide.

Documentation

Support

File bugs and feature requests on the issue tracker. For a bug, please attach a minimal PDF that reproduces it.

pypdfbox is a community port, not an official Apache release. Because the API mirrors Apache PDFBox, general "how do I do X with PDFBox" answers usually translate directly — but please don't file pypdfbox bugs with the Apache project.

Contributing

PRs welcome.

git clone https://github.com/mehdyhaghy/pypdfbox.git
cd pypdfbox
uv sync --all-groups
.venv/bin/pytest -q --no-cov

Changes must match upstream PDFBox naming and behaviour. See CONTRIBUTING.md and the developer workflow.

License

Apache License 2.0, same as upstream PDFBox — see LICENSE and NOTICE. All runtime dependencies are permissively licensed.

Ported files are tracked in PROVENANCE.md, which satisfies Apache 2.0 §4(b) in one place; source files carry no per-file headers. Behavioural deviations are in CHANGES.md.

Export control: this software contains cryptographic functionality (PDF encryption and signatures, via PyCA cryptography). Your country may restrict import, possession, use, or re-export — check local law. Details.

Upstream

pypdfbox is a port of Apache PDFBox, maintained by the Apache Software Foundation. The COS model, parser architecture, content-stream operators, accessibility model, font subsystem, signature pipeline, and rendering design it mirrors are the cumulative work of the PDFBox maintainers and contributors.

This is a community port. It is not endorsed by, affiliated with, or released by the Apache Software Foundation. Bugs in pypdfbox are bugs in pypdfbox, not in Apache PDFBox.

Metadata

Release files for pypdfbox 2.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypdfbox 2.6.0
File Size Uploaded Provenance Actions
pypdfbox-2.6.0.tar.gz 7.7 MB With provenance Details for pypdfbox-2.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pypdfbox 2.6.0
File Interpreter ABI Platform Actions
pypdfbox-2.6.0-py3-none-any.whl Python 3 none any Details for pypdfbox-2.6.0-py3-none-any.whl

Total release size: 16.3 MB

Release files / pypdfbox-2.6.0.tar.gz

Download URL pypdfbox-2.6.0.tar.gz
Size 7.7 MB
Tags Source
SHA-256 checksum
How to use checksums
95447cbab0ab9db200b624020df93b3a9735ef8701e6c70be7ee99655508df54
BLAKE2b-256 checksum
How to use checksums
3aae8497c6ad76dac08e607f7cf926b1a80434c85874882708b6bbc7924f4ba1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / pypdfbox-2.6.0-py3-none-any.whl

Download URL pypdfbox-2.6.0-py3-none-any.whl
Size 8.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ef1ce570955c0ce962d5a4d4c60fccc43b68affec6df2d8bd4fd20105c932e5a
BLAKE2b-256 checksum
How to use checksums
6686a728d11e2647c05a79c24888544286b48c488f9f7a0126b8965a045f35e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for pypdfbox 2.6.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pypdfbox-2.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page