# pypdf: A Powerful Pure-Python Library for PDF Manipulation

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/py-pdf-pypdf
Generated for open source discovery and AI-assisted research.

pypdf is a free and open-source pure-Python library designed for comprehensive PDF manipulation. It allows users to split, merge, crop, and transform PDF pages, as well as add custom data, viewing options, and passwords. The library also supports extracting text and metadata from PDF files, making it a versatile tool for various PDF-related tasks.

GitHub: https://github.com/py-pdf/pypdf
OSRepos URL: https://osrepos.com/repo/py-pdf-pypdf

## Summary

pypdf is a free and open-source pure-Python library designed for comprehensive PDF manipulation. It allows users to split, merge, crop, and transform PDF pages, as well as add custom data, viewing options, and passwords. The library also supports extracting text and metadata from PDF files, making it a versatile tool for various PDF-related tasks.

## Topics

- Python
- PDF
- PDF Manipulation
- PDF Parsing
- Document Automation
- pypdf
- Library

## Repository Information

Last analyzed by OSRepos: Wed Dec 24 2025 12:00:56 GMT+0000 (Western European Standard Time)
Detail views: 4
GitHub clicks: 5

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction

pypdf is a robust, pure-Python PDF library that empowers developers to interact with PDF files programmatically. It offers a wide array of functionalities, including splitting, merging, cropping, and transforming pages. Beyond basic manipulation, pypdf can also add custom data, set viewing options, and apply password protection to your PDF documents. Furthermore, it provides capabilities to extract text and metadata, making it an essential tool for automating PDF workflows.

## Installation

Getting started with pypdf is straightforward using pip.

bash
pip install pypdf


For advanced features like AES encryption or decryption, you can install additional dependencies:

bash
pip install pypdf[crypto]


Note that `pypdf` versions 3.1.0 and above include significant improvements. Please refer to the official [migration guide](https://pypdf.readthedocs.io/en/latest/user/migration-1-to-2.html){:target="_blank"} for more details.

## Examples

Here's a quick example demonstrating how to read a PDF and extract text from its first page:

python
from pypdf import PdfReader

reader = PdfReader("example.pdf")
number_of_pages = len(reader.pages)
page = reader.pages[0]
text = page.extract_text()
print(f"Number of pages: {number_of_pages}")
print(f"Text from first page: {text[:200]}...") # Print first 200 chars


pypdf supports many other operations, such as splitting, merging, reading and creating annotations, and encryption/decryption. Check out the [documentation](https://pypdf.readthedocs.io/en/stable/){:target="_blank"} for additional usage examples!

## Why Use pypdf

pypdf stands out as a comprehensive solution for PDF handling in Python due to several key advantages. Its pure-Python implementation ensures broad compatibility and ease of integration into Python projects without external binaries. The library's extensive feature set covers everything from basic page manipulation to advanced tasks like metadata extraction and security. With an active development team and a supportive community, pypdf is continuously improved and well-maintained, offering reliable performance for your PDF processing needs.

## Links

For more information and to dive deeper into pypdf:

*   **GitHub Repository:** [https://github.com/py-pdf/pypdf](https://github.com/py-pdf/pypdf){:target="_blank"}
*   **Official Documentation:** [https://pypdf.readthedocs.io/en/stable/](https://pypdf.readthedocs.io/en/stable/){:target="_blank"}
*   **StackOverflow (Q&A):** [https://stackoverflow.com/questions/tagged/pypdf](https://stackoverflow.com/questions/tagged/pypdf){:target="_blank"}