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+. 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.3.1

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.3.1
File Size Uploaded Provenance Actions
pypdfbox-2.3.1.tar.gz 8.0 MB With provenance Details for pypdfbox-2.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 16.5 MB

Release files / pypdfbox-2.3.1.tar.gz

Download URL pypdfbox-2.3.1.tar.gz
Size 8.0 MB
Tags Source
SHA-256 checksum
How to use checksums
a6a324040ac36c7e978d9668114ed6e1ac2fc5f751fb736c475dd3b965db9984
BLAKE2b-256 checksum
How to use checksums
f680151e24fcf3a2a40f9d5ac9a542266b5cf5e10d8af757a194572dace0bd9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

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

Download URL pypdfbox-2.3.1-py3-none-any.whl
Size 8.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
00238162c79382db8c1b6beb821d8d4852044c8e5f7e4070d24945ed729df4eb
BLAKE2b-256 checksum
How to use checksums
24ca08eb583fd2608353231269eec76a51c49e435cadaaaba35f30c0aa104f2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

Security for pypdfbox 2.3.1

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.3.1.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 Oct 19, 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