Skip to main content

pdfmonkey

One-call PDF table extraction that returns clean Python data instead of jumbled text. pdfplumber handles ruled tables; a position-based heuristic reconstructs borderless ones; multi-page tables are stitched back together; every table comes with a confidence score.

import pdfmonkey

tables = pdfmonkey.extract_tables("report.pdf")
tables[0].to_dicts()
# [{'Name': 'Alice', 'Age': '30', 'City': 'London'},
#  {'Name': 'Bob',   'Age': '25', 'City': 'Paris'}]

Why

Existing tools (pdfplumber, PyMuPDF, pdfminer) produce output where columns bleed, rows split, headers detach, and multi-page tables fragment. Closing that gap takes 100–200 lines of heuristic glue every time. pdfmonkey is that glue, packaged: raw PDF in, clean list[dict] out.

Install

pip install pdfmonkey            # core (pdfplumber only)
pip install pdfmonkey[enrich]    # + enrich=True column types & text cleaning
pip install pdfmonkey[pandas]    # + Table.to_dataframe()
pip install pdfmonkey[dev]       # + test toolchain

The enrich extra pulls in the monkey ecosystem (cleanmonkey, datemonkey, typemonkey). The core install does not require them: enrich=True records a diagnostic and leaves column_types empty when they are absent, and text extraction attempts cleanmonkey only via a guarded import before falling back to a built-in cleaner.

Requires Python 3.11+.

Library API

import pdfmonkey

# Headline one-call API -> list[Table]
tables = pdfmonkey.extract_tables(
    "report.pdf",
    pages="1-3,5",        # None/"all", "3", "2-5", "1,3,5-7"
    merge=True,           # stitch tables continued across pages (matching headers)
    merge_headerless=False,  # also stitch a headerless continuation (looser; opt-in)
    enrich=False,         # annotate Table.column_types via the monkey ecosystem
    min_confidence=0.0,   # drop tables scoring below this
)

# Rich result with diagnostics -> ExtractionResult
result = pdfmonkey.extract("report.pdf")
result.strategy_used      # 'pdfplumber' | 'heuristic' | 'mixed' | 'none'
result.tables             # list[Table]

# Clean text, paragraph-preserving -> str
text = pdfmonkey.extract_text("report.pdf", pages="1")

Each Table converts to whatever shape you need:

table.to_dicts()       # list[dict]      (dsvmonkey input, pgmonkey CSV import)
table.to_lists()       # list[list[str]] (header row first)
table.to_csv()         # str
table.to_json()        # str
table.to_dataframe()   # pandas.DataFrame (needs the [pandas] extra)

CLI

pdfmonkey extract report.pdf                 # CSV to stdout
pdfmonkey extract report.pdf -f json -p 1-3  # JSON, pages 1–3
pdfmonkey extract report.pdf --text          # clean text instead of tables
pdfmonkey inspect report.pdf                 # shape/confidence/strategy, no data dump

inspect is the "should I trust this extraction?" command — it reports each table's pages, shape, confidence, detecting strategy, and diagnostics without printing the data.

Ecosystem

Built to interoperate with the monkey toolkit: to_dicts() feeds dsvmonkey, to_csv() imports via pgmonkey, two tables compare with diffmonkey. With enrich=True, cleanmonkey normalises cells and datemonkey/typemonkey populate Table.column_types.

Scope

In scope: table detection, extraction, multi-page merging, structural analysis, text extraction. Out of scope: PDF creation/editing, form filling, image extraction, OCR, merging/splitting files.

Design tradeoffs

See LIMITATIONS.md for deliberate design tradeoffs (e.g. missing-vs-empty cells, header detection, conservative multi-page merge) before filing what looks like a bug.

Using with AI assistants

SKILL.md is an LLM-consumable guide (decision tree, worked examples, anti-patterns) so assistants reach for pdfmonkey instead of hand-rolling pdfplumber glue.

Contributing & quality

CONTRIBUTING.md is the project's quality contract — the testing philosophy and the competitive multi-model review methodology pdfmonkey is hardened with. The release decision is made explicit and measurable: RELEASE_READINESS.md defines the rubric, python scripts/readiness.py computes the score, and REVIEW_HISTORY.md records the panel trajectory. The portable source of this methodology lives in review-kit/.

Changelog

Release history is in CHANGELOG.md.

License

MIT — see LICENSE.

Metadata

Release files for pdfmonkey 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdfmonkey 1.0.3
File Size Uploaded Provenance
pdfmonkey-1.0.3.tar.gz 56.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pdfmonkey 1.0.3
File Interpreter ABI Platform
pdfmonkey-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 87.4 kB

Release files / pdfmonkey-1.0.3.tar.gz

Download URL pdfmonkey-1.0.3.tar.gz
Size 56.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fd79d593eaf3b90a008ea7743c407ca1ba69b6e6d7c4173d0c3b5a08c8e45e7e
BLAKE2b-256 checksum
How to use checksums
11f4f6f0175d8da854dee579b8ff0f42645c69de0e42a9331baf4c0796bc0fdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / pdfmonkey-1.0.3-py3-none-any.whl

Download URL pdfmonkey-1.0.3-py3-none-any.whl
Size 30.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d69a075f0dee5deb6abcdcb5a4cb7a1d2df53e31723a39541af267caabe4e2e1
BLAKE2b-256 checksum
How to use checksums
29dac726ad01cb6a14ab955fa16d7b8b89f725c317f4cea13f6549f7f119b3db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for pdfmonkey 1.0.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page