Pythie
CategoriesTrending
An open index of Python tools.Pythie’s IndexLegal noticePrivacyData: PyPI (package metadata; download statistics under CC BY 4.0, via ClickHouse), deps.dev (CC BY 4.0), GitHub, OSV.

pypdf

7.2.0ActivePythie’s Index: 93

A pure-python PDF library capable of splitting, merging, cropping, and transforming PDF files

Actively maintained. Last release 3 days ago, commits in 23 of the last 26 weeks. A safe choice.

File Formats & Parsing
$pip install pypdf
py-pdf/pypdfHomepagePyPI

PyPI version Python Support GitHub last commit codecov

pypdf

pypdf is a free and open-source pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files. It can also add custom data, viewing options, and passwords to PDF files. pypdf can retrieve text and metadata from PDFs as well.

See pdfly for a CLI application that uses pypdf to interact with PDFs.

Installation

Install pypdf using pip:

pip install pypdf

For using pypdf with AES encryption or decryption, install extra dependencies:

pip install pypdf[crypto]

NOTE: pypdf 3.1.0 and above include significant improvements compared to previous versions. Please refer to the migration guide for more information.

Usage

from pypdf import PdfReader

reader = PdfReader("example.pdf")
number_of_pages = len(reader.pages)
page = reader.pages[0]
text = page.extract_text()

pypdf can do a lot more, e.g. splitting, merging, reading and creating annotations, decrypting and encrypting. Check out the documentation for additional usage examples!

For questions and answers, visit StackOverflow (tagged with pypdf).

Contributions

Maintaining pypdf is a collaborative effort. You can support the project by writing documentation, helping to narrow down issues, and submitting code. See the CONTRIBUTING.md file for more information.

Q&A

The experience pypdf users have covers the whole range from beginner to expert. You can contribute to the pypdf community by answering questions on StackOverflow, helping in discussions, and asking users who report issues for MCVE's (Code + example PDF!).

Issues

A good bug ticket includes a MCVE - a minimal complete verifiable example. For pypdf, this means that you must upload a PDF that causes the bug to occur as well as the code you're executing with all of the output. Use print(pypdf.__version__) to tell us which version you're using.

Code

All code contributions are welcome, but smaller ones have a better chance to get included in a timely manner. Adding unit tests for new features or test cases for bugs you've fixed help us to ensure that the Pull Request (PR) is fine.

pypdf includes a test suite which can be executed with pytest:

$ pytest
===================== test session starts =====================
platform linux -- Python 3.6.15, pytest-7.0.1, pluggy-1.0.0
rootdir: /home/moose/GitHub/Martin/pypdf
plugins: cov-3.0.0
collected 233 items

tests/test_basic_features.py ..                         [  0%]
tests/test_constants.py .                               [  1%]
tests/test_filters.py .................x.....           [ 11%]
tests/test_generic.py ................................. [ 25%]
.............                                           [ 30%]
tests/test_javascript.py ..                             [ 31%]
tests/test_merger.py .                                  [ 32%]
tests/test_page.py .........................            [ 42%]
tests/test_pagerange.py ................                [ 49%]
tests/test_papersizes.py ..................             [ 57%]
tests/test_reader.py .................................. [ 72%]
...............                                         [ 78%]
tests/test_utils.py ....................                [ 87%]
tests/test_workflows.py ..........                      [ 91%]
tests/test_writer.py .................                  [ 98%]
tests/test_xmp.py ...                                   [100%]

========== 232 passed, 1 xfailed, 1 warning in 4.52s ==========

Popularity

Downloads / month
216.9M
GitHub stars
10.3K
Downloads, last 7 days
55M+6%
Stars, last 7 days
–
Direct dependents
2K
All dependents
2.7K

Pythie’s Index

How it works
93

Healthy

Maintenance, out of 100

  • Recent release

    last release 2 days ago

  • Commit activity

    23/26 weeks with commits

  • Release cadence

    50 releases in 12 months

  • Issues & PRs handled

    63% closed in the past year

  • Contributor spread

    34 authors in last 100 commits

  • OpenSSF Scorecard

    8.7/10

Commits, last 26 weeks531

Releases

Latest
7.2.0
Released
Nov 26, 2026
Releases, 12 months
50
First release
May 17, 2014

Compatibility

Requires Python
>=3.10
Tested on
3.10 · 3.11 · 3.12 · 3.13 · 3.14 · 3.15
License
BSD-3-Clause (Permissive)

Keywords

pypdf2pdfpythonpdf-parserpdf-parsingpdf-manipulationpdf-documentshelp-wanted

Alternatives

Use instead of pypdf: tools that do the same job, closest first.

Compare with PyPDF2 →Compare with pymupdf →Compare with PyPDF4 →Compare all 4 →

  • PyPDF23.0.1ActivePythie’s Index: 57

    A pure-python PDF library capable of splitting, merging, cropping, and transforming PDF files

    File Formats & Parsing10.3K15.4M/moReleased Dec 31, 2022
  • pymupdf2.2ActivePythie’s Index: 86

    A high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.

    File Formats & ParsingImages & Computer Vision11.2K185.8M/moReleased Nov 25, 2026
  • PyPDF41.27.0InactivePythie’s Index: 19

    PDF toolkit

    File Formats & Parsing–108.3K/moReleased Aug 7, 2018
  • pikepdf10.18.3ActivePythie’s Index: 85

    Read, write, repair, and transform PDFs in Python, powered by qpdf

    File Formats & Parsing2.8K14.9M/moReleased Nov 26, 2026
  • pypdftk0.5InactivePythie’s Index: 19

    Python wrapper for PDFTK

    File Formats & ParsingUtilities & Language Tools150133.6K/moReleased Apr 11, 2021
  • pdf-oxide0.3.78ActivePythie’s Index: 82

    The fastest Python PDF library — 0.8ms mean, 5× faster than the industry leaders, 100% pass rate on 3,830 real-world PDFs. Text extraction, Markdown/HTML conversion, PDF creation and editing.

    Utilities & Language ToolsFile Formats & Parsing1.2K227.8K/moReleased Sep 8, 2026

Works well with

Use together with pypdf: extensions, drivers, servers and companion tools.

  • PyPDFFormPythie’s Index: 85The Python library & CLI for PDF forms.154K downloads/mo
  • drafthorsePythie’s Index: 25Python ZUGFeRD XML implementation169.4K downloads/mo
  • paper-qa-pypdfPythie’s Index: 77PaperQA readers implemented using PyPDF120.7K downloads/mo