ocr-and-documents

Extract text, tables, and images from PDFs and scanned documents using pymupdf or marker-pdf.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/CHENHUI-X/toolbox --skill ocr-and-documents-chenhui-x
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ocr-and-documents
Source: https://github.com/CHENHUI-X/toolbox/tree/main/custom-skills/productivity/ocr-and-documents
Command: npx skills add https://github.com/CHENHUI-X/toolbox --skill ocr-and-documents-chenhui-x

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pymupdf, pymupdf4llm, marker-pdf, and includes scripts (resource) components.

What problem does it solve? Getting usable text out of PDFs and scanned documents is inconsistent: text-based PDFs need lightweight parsing, while scanned pages, equations, and complex layouts require full OCR. This Skill routes each document to the right extractor so you get clean text or Markdown without trial and error. ## Core Features & Use Cases - Dual extraction engines: pymupdf for fast, lightweight text, table, image, and metadata extraction; marker-pdf for OCR of scanned documents in 90+ languages, equations, forms, and complex layouts. - Remote URL handling: tries web_extract first for documents available at a URL, including arXiv abstracts and full papers, avoiding local dependencies entirely. - PDF utilities: split, merge, and full-text search across pages using pymupdf with no extra dependencies. - Use Case: You receive a scanned 40-page contract as a PDF. The Skill detects it has no text layer, checks disk space, and runs marker-pdf OCR to produce structured Markdown with preserved tables and reading order. ## Quick Start Extract the text from my local file report.pdf, using OCR if any pages are scanned images.

Frequently Asked Questions about ocr-and-documents

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract text from a PDF in Python?

Use pymupdf to open the PDF and call get_text() on each page, or run the extract_pymupdf.py script for plain text, Markdown, tables, or metadata. It installs in seconds at about 25MB and handles text-based PDFs instantly.

pymupdf vs marker-pdf for PDF extraction?

pymupdf is lightweight (~25MB) and instant but only reads existing text layers. marker-pdf (~3-5GB with PyTorch) adds OCR for scanned documents in 90+ languages, plus equations, forms, and reading-order detection. Use pymupdf unless you need OCR or complex layout analysis.

How do I OCR a scanned PDF document?

Use marker-pdf via the extract_marker.py script, which performs OCR on scanned pages and outputs Markdown. For just a few pages, render them with pdftoppm at 150 DPI and analyze each image with a vision model instead.

Does pymupdf work on scanned PDFs without a text layer?

No, pymupdf only reads the existing text layer and returns nothing for scanned image pages. For those documents you need marker-pdf's OCR, or render pages to images and use a vision model for small page counts.

Why does marker-pdf installation fail or get declined?

marker-pdf requires roughly 5GB of free disk for PyTorch plus about 2.5GB of models downloaded to the HuggingFace cache on first use. Run extract_marker.py --check to verify disk space, or fall back to pymupdf or web_extract for URL-based documents.

How do I extract text from a PDF available at a URL?

Call web_extract with the PDF URL first, which converts it to Markdown via Firecrawl with no local dependencies. This works for arXiv papers and hosted reports; only use local extraction when the file is local or web_extract fails.