Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

pypdf

> 编程语言
Open source

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

10.1K stars0 likes3 views
WebsiteGitHub

About

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

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:

bash
pip install pypdf

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

bash
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

python
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:

…

Issues· 140 open

View all issuesOpen on GitHub
  • #4130

    extract_text() drops the wrapped second line of a table cell since 6.16.2 (regression from 6.16.1)

    workflow-text-extractionUpdated Sep 28, 2026
  • #4127

    `PdfReader` cannot open a file whose `%%EOF` marker is not at the start of a line (`startxref <offset>%%EOF`)

    is-robustness-issueUpdated Sep 24, 2026
  • #4113

    BUG: 6.16.0 inserts spurious spaces inside words in `extract_text()` for subset TrueType fonts without `/Encoding` (regression from #3905)

    workflow-text-extractionwhitespaceUpdated Sep 22, 2026
  • #4110

    BUG: layout mode splits words when the font size travels in Tm (space_tx is not transformed into page space)

    workflow-text-extractionUpdated Sep 21, 2026
  • #4111

    compress_identical_objects() followed by compress_content_streams() silently drops shared content stream parts

    is-bugUpdated Sep 20, 2026
  • #3689

    Fix `testtype` Makefile target

    needs-discussionis-maintenanceUpdated Sep 18, 2026
  • #4068

    Move `_font.py` to `generic` module

    is-maintenanceUpdated Sep 14, 2026
  • #4067

    Synthetic-space detection may insert spaces for small positioning differences

    workflow-text-extractionwhitespaceUpdated Sep 12, 2026
  • #1453

    Pagedest (addlink) not working as intended with positional parameters .

    is-bugUpdated Sep 11, 2026
  • #92

    Support for Optional Content Groups

    PdfReaderis-featureUpdated Sep 4, 2026

> Tags

Pythonhelp-wantedpdfpdf-documentspdf-manipulation

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言