pypdf: A Powerful Pure-Python Library for PDF Manipulation
This repository profile is provided by osrepos.com, an open source repository discovery platform.

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.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
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.
pip install pypdf
For advanced features like AES encryption or decryption, you can install additional dependencies:
pip install pypdf[crypto]
Note that pypdf versions 3.1.0 and above include significant improvements. Please refer to the official migration guide for more details.
Examples
Here's a quick example demonstrating how to read a PDF and extract text from its first page:
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 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
- GitHub Repository: https://github.com/py-pdf/pypdf
- Official Documentation: https://pypdf.readthedocs.io/en/stable/
- StackOverflow (Q&A): https://stackoverflow.com/questions/tagged/pypdf
Related repositories
Similar repositories that may be relevant next.

Mergoo: Efficiently Merge and Train Multiple LLM Experts
July 7, 2026
Mergoo is an open-source Python library designed to simplify the merging of multiple Large Language Model (LLM) experts. It enables efficient training of these merged LLMs, allowing users to integrate knowledge from various generic or domain-specific models. The library supports several merging methods, including Mixture-of-Experts and Mixture-of-Adapters, across popular base models.

Ludwig: Low-Code Declarative Deep Learning for LLMs and AI Models
July 6, 2026
Ludwig is a powerful, low-code declarative deep learning framework designed for building custom LLMs, neural networks, and other AI models. It simplifies the process of training, fine-tuning, and deploying models, from LLM fine-tuning to tabular classification, using a simple YAML configuration without boilerplate Python code. This makes advanced AI development accessible and efficient for a wide range of applications.

Lamini: The Official Python Client for Generative AI API
July 6, 2026
Lamini is the official Python client and SDK designed to interact with the Lamini API, enabling developers to create their own Generative AI applications. It provides a straightforward interface for integrating powerful AI capabilities into Python projects. This package simplifies the process of building and deploying generative AI solutions.
xTuring: Build, Personalize, and Control Your Own LLMs
July 6, 2026
xTuring is an open-source framework designed to simplify the process of building, personalizing, and controlling Large Language Models (LLMs). It provides an easy way to fine-tune open-source LLMs on your own data, offering features from data pre-processing to efficient training and inference. This tool empowers developers to create private, personalized LLMs locally or in their private cloud environments.
Source repository
Open the original repository on GitHub.