readpdf
Convert PDFs to text for token-efficient AI agent reading.
Why
Reading PDFs with vision costs 100–500 tokens per page. Converting to text first lets any AI agent read only the sections it needs — saving up to 90% of tokens.
Install
pip install readpdf
Requires pdftotext:
# macOS
brew install poppler
# Linux
apt install poppler-utils
Usage
# Convert to file, then read selectively
readpdf paper.pdf -o paper.txt
# Extract a single page
readpdf paper.pdf -o paper.txt -p 3
# Extract a page range
readpdf paper.pdf -o paper.txt --pages 3-7
# Print to stdout
readpdf paper.pdf
Works with any AI agent that has shell access: Claude, GPT-4, Gemini, Cursor, etc.
How it works
Without readpdf:
PDF → AI vision → ~200 tokens/page × 30 pages = 6,000 tokens (full doc, every time)
With readpdf:
PDF → pdftotext → paper.txt (on disk, 0 tokens)
AI reads only offset/limit chunks it needs → ~300 tokens total
Step 1. readpdf paper.pdf -o paper.txt runs pdftotext locally — no AI tokens consumed.
Step 2. The AI uses a file-reading tool (e.g. Read with offset/limit) to load only the relevant lines. Because the text file already exists on disk, the AI never pays the cost of processing the entire PDF.
Why not MCP? MCP tool results return the full content back into the AI's context window — same cost as reading directly. A disk file lets the AI pull exactly the slice it needs, nothing more.
License
MIT
Metadata
Release files for readpdf-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| readpdf_cli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for readpdf_cli-0.1.0-py3-none-any.whl |
Release files / readpdf_cli-0.1.0-py3-none-any.whl
| Download URL | readpdf_cli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9e7338a0266aae03f1389665d2d42db396a54ee83340bd2dfee06c6057781a2
|
|
BLAKE2b-256 checksum How to use checksums |
ec7fa3e18df07c89eb4599b6ae8d3f1419db04e2e0b5ed76574b3f6d7431dd9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for readpdf-cli 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.