agentsclimarketplace

Extract pdf

Skill spotcircuit/rebar/.claude/skills/productivity/extract-pdf

Extract text, tables, and images from PDFs (and scanned PDFs via OCR) using pymupdf for light/fast jobs and marker-pdf for OCR/equations/complex layouts. Use when an operator needs to pull content out of a client deck, contract, scanned form, research paper, or any PDF artifact — pick pymupdf for text-based PDFs (~25 MB install, instant) and marker-pdf only when OCR, equations, or layout reconstruction is required (3–5 GB models).From its SKILL.md

Install
npx -y skills add spotcircuit/rebar --skill extract-pdf

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

5.1 KB, as published. Nobody here has run it

extract-pdf — PDF and document extraction

Adapted from the Hermes Agent ocr-and-documents skill. Two extractors, one decision: pymupdf for speed, marker-pdf for hard cases.

For DOCX use python-docx (parses real document structure — better than OCR). For PPTX use a python-pptx-based flow. This skill is PDFs and scanned documents.

When this skill writes outputs (extracted markdown, tables, images), drop them under clients/{client}/pdf-extract-{YYYY-MM-DD}/ or apps/{app}/pdf-extract-{date}/. Never write to ~/.

Step 1: URL? Try web extract first

If the PDF has a URL, prefer a remote-fetch tool (e.g. WebFetch / Firecrawl) before installing local extractors. No deps, instant.

Use local extraction when: the file is local, the remote fetch fails, or you need batch/offline processing.

Step 2: Pick the extractor

Featurepymupdf (~25 MB)marker-pdf (~3–5 GB)
Text-based PDFyesyes
Scanned PDF (OCR)noyes (90+ languages)
Tablesbasichigh accuracy
Equations / LaTeXnoyes
Code blocksnoyes
Formsnoyes
Header/footer removalnoyes
Reading-order detectionnoyes
Image extractionembeddedwith context
Image OCRnoyes
EPUByesyes
Markdown outputvia pymupdf4llmnative, higher quality
Speedinstant1–14 s/page CPU

Default to pymupdf. Reach for marker-pdf only when you actually need OCR, equations, forms, or layout analysis.

If the user needs marker capabilities but the system lacks ~5 GB free disk, escalate before installing. Tell them their options: free disk, supply a URL we can WebFetch, or accept pymupdf's text-only result.


pymupdf (lightweight)

pip install pymupdf pymupdf4llm

Helper script:

SKILL=.claude/skills/productivity/extract-pdf/scripts
python3 $SKILL/extract_pymupdf.py document.pdf              # plain text
python3 $SKILL/extract_pymupdf.py document.pdf --markdown   # markdown
python3 $SKILL/extract_pymupdf.py document.pdf --tables     # tables
python3 $SKILL/extract_pymupdf.py document.pdf --images out/ # extract images
python3 $SKILL/extract_pymupdf.py document.pdf --metadata   # title, author, pages
python3 $SKILL/extract_pymupdf.py document.pdf --pages 0-4  # specific pages

Inline:

python3 -c "
import pymupdf
doc = pymupdf.open('document.pdf')
for page in doc:
    print(page.get_text())
"

marker-pdf (high-quality OCR)

# Check disk space first
python3 .claude/skills/productivity/extract-pdf/scripts/extract_marker.py --check
pip install marker-pdf

Helper script:

SKILL=.claude/skills/productivity/extract-pdf/scripts
python3 $SKILL/extract_marker.py document.pdf              # markdown
python3 $SKILL/extract_marker.py document.pdf --json       # JSON + metadata
python3 $SKILL/extract_marker.py document.pdf --output_dir out/
python3 $SKILL/extract_marker.py scanned.pdf               # scanned PDF (OCR)
python3 $SKILL/extract_marker.py document.pdf --use_llm    # LLM-boosted accuracy

CLI (installed with marker-pdf):

marker_single document.pdf --output_dir ./output
marker /path/to/folder --workers 4    # batch

Split, merge, search

pymupdf covers these natively:

# Split: extract pages 1-5
import pymupdf
doc = pymupdf.open("report.pdf")
new = pymupdf.open()
for i in range(5):
    new.insert_pdf(doc, from_page=i, to_page=i)
new.save("pages_1-5.pdf")

# Merge multiple PDFs
result = pymupdf.open()
for path in ["a.pdf", "b.pdf", "c.pdf"]:
    result.insert_pdf(pymupdf.open(path))
result.save("merged.pdf")

# Search across pages
doc = pymupdf.open("report.pdf")
for i, page in enumerate(doc):
    if page.search_for("revenue"):
        print(f"Page {i+1} hit")

Notes

  • WebFetch / remote extract first when a URL is available
  • pymupdf is the safe default; install marker-pdf only when needed
  • marker-pdf downloads ~2.5 GB to ~/.cache/huggingface/ on first use
  • Both helper scripts accept --help
  • For Word docs: pip install python-docx
  • For PPT: use a python-pptx flow (separate skill)

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.