pdfreader
- Info:
See the pdfreader documentation.
- Author & Maintainer:
Maksym Polshcha <maxp@sterch.net>
pdfreader is a read-only Python PDF parser that reads PDF structure directly and extracts text, images, forms, fonts, CMaps, annotations, metadata, and other document objects. It does not require an external PDF engine or rasterize pages to expose their contents.
Use pdfreader when a Python application needs read-only access to PDF content, low-level PDF objects, or predictable memory controls for large documents. Text extraction preserves the source content-stream order and offers opt-in diagnostics and custom mappings for font codes that a PDF does not map reliably to Unicode.
The library provides two complementary interfaces:
PDFDocument exposes the document catalog, page tree, indirect objects, streams, and metadata.
SimplePDFViewer interprets page content and writes decoded data to a SimpleCanvas.
What pdfreader provides
Extract PDF text and page content: decode string fragments, text-showing groups, images, form XObjects, annotations, and inline images through SimpleCanvas.
Inspect PDF structure: access the document catalog, page tree, indirect objects, streams, fonts, CMaps, and metadata with PDFDocument.
Process large PDFs: resolve objects lazily, reuse page and font indexes, and opt into bounded caches when memory retention matters.
Diagnose custom fonts: collect unresolved glyph codes, supply a document-local glyph resolver, or choose an explicit unknown-glyph policy.
Read protected PDFs: open password-protected documents that use a supported PDF standard security handler.
Save extracted images: convert supported PDF image objects to Pillow images.
pdfreader does not create, edit, split, merge, rasterize, or convert PDF files. Extracted text follows content-stream order and does not automatically reconstruct visual lines, columns, or tables.
PDF version compatibility
pdfreader targets the PDF 1.7 data model and recognizes standard %PDF-2.0 file headers. Header recognition does not imply complete support for every feature introduced by ISO 32000-2. See the PDF compatibility guide for the tested boundary and reporting guidance.
Installation
pdfreader is tested on Python 3.6 through Python 3.14. Install it from PyPI with pip:
python -m pip install pdfreader
Extract text from a PDF in Python
Extract decoded string fragments from the first page:
from pdfreader import SimplePDFViewer
with open("document.pdf", "rb") as stream:
viewer = SimplePDFViewer(stream)
viewer.navigate(1)
viewer.render()
text = "".join(viewer.canvas.strings)
PDF text is stored as font-specific character codes and drawing operators, not as ready-made paragraphs. For PDFs with missing Unicode mappings, use the unknown-glyph diagnostics and custom mapping guide. For sequential scans or long-running services, see the large-PDF performance and bounded-cache guide.
Documentation
Support and source
Use GitHub issues for bug reports, questions, and feature requests. The latest source is available in the GitHub repository.
References
Metadata
Release files for pdfreader 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pdfreader-0.2.0.tar.gz | 2.7 MB | Without provenance | Details for pdfreader-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pdfreader-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pdfreader-0.2.0-py3-none-any.whl |
Total release size: 2.9 MB
Release files / pdfreader-0.2.0.tar.gz
| Download URL | pdfreader-0.2.0.tar.gz |
|---|---|
| Size | 2.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00de66f1f468a209db328891c19639e9a26ffbf08bc02fb0ce7bee864b6a1f89
|
|
BLAKE2b-256 checksum How to use checksums |
ac23a24fe58c1206e4fc14c50f52c49d2ea90f806ce2f532a93bac856b0c579b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pdfreader-0.2.0-py3-none-any.whl
| Download URL | pdfreader-0.2.0-py3-none-any.whl |
|---|---|
| Size | 193.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc7c84a8fca1dbbb393f6c4edb31c95dfe03a27c2e1a44b1cca3ca8ce4fa480c
|
|
BLAKE2b-256 checksum How to use checksums |
b37a4e639e010eaac8fb5e8254018c188be8ab6076ccedbecfca2e1201795561
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for pdfreader 0.2.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.