# Doc Reader

> PDF/DOCX/XLSX/image document intelligence — text extraction, table parsing, OCR, financial statement analysis, contract clause detection, document classification, and format conversion. Use when reading, analyzing, extracting data from, or converting documents.

- **Type:** Skill
- **Install:** `agentstack add skill-jansenanalytics-claudex-doc-reader`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [JansenAnalytics](https://agentstack.voostack.com/s/jansenanalytics)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [JansenAnalytics](https://github.com/JansenAnalytics)
- **Source:** https://github.com/JansenAnalytics/claudex/tree/main/skills/doc-reader

## Install

```sh
agentstack add skill-jansenanalytics-claudex-doc-reader
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Doc Reader — Document Intelligence

Extract text, tables, and insights from any document format. Handles native text PDFs, scanned documents (OCR), Word files, spreadsheets, images, and HTML.

## Quick Reference

```bash
SCRIPTS=${CLAUDE_SKILLS_DIR:-$HOME/.claude-agent/.claude/skills}/doc-reader/scripts

# Extract text from any document
python3 $SCRIPTS/extract.py document.pdf

# Extract tables only
python3 $SCRIPTS/extract.py document.pdf --mode tables

# Full analysis (text + tables + metadata)
python3 $SCRIPTS/extract.py document.pdf --mode summary

# OCR scanned document
python3 $SCRIPTS/extract.py scanned.pdf --mode ocr --ocr-lang eng+nor

# Analyze document (classify, extract figures, structure)
python3 $SCRIPTS/analyze.py document.pdf --extract-figures

# Convert between formats
python3 $SCRIPTS/convert.py report.pdf report.md
python3 $SCRIPTS/convert.py data.xlsx data.csv
```

---

## Scripts

### 1. `extract.py` — Universal Text & Table Extraction

The core extraction engine. Supports PDF, DOCX, XLSX, CSV, images, HTML, and plain text.

#### Extraction Modes

| Mode | Description |
|------|-------------|
| `text` | Full text extraction (default). Auto-falls back to OCR for scanned pages |
| `tables` | Table extraction only (as markdown, CSV, or JSON) |
| `meta` | Document metadata (author, dates, page count, file size) |
| `summary` | Text + tables + metadata combined |
| `ocr` | Force OCR on all pages (for fully scanned documents) |
| `layout` | Layout-preserving text extraction via pdftotext (columns, spacing) |
| `images` | Extract embedded images from PDF |

#### Usage

```bash
# Basic text extraction
python3 extract.py report.pdf
python3 extract.py contract.docx
python3 extract.py financials.xlsx

# Specific pages
python3 extract.py annual-report.pdf --pages 1-5,8,12-15

# Table extraction as JSON
python3 extract.py financials.pdf --mode tables --table-format json

# OCR with Norwegian + English
python3 extract.py scan.pdf --mode ocr --ocr-lang eng+nor

# Full summary to file
python3 extract.py report.pdf --mode summary --output /tmp/report-summary.txt

# JSON output (for programmatic use)
python3 extract.py report.pdf --mode summary --json --output /tmp/report.json

# Excel: specific sheet
python3 extract.py data.xlsx --sheet "Revenue" --mode tables

# Layout mode (preserves columns in multi-column PDFs)
python3 extract.py newspaper.pdf --mode layout

# Limit page count
python3 extract.py huge-doc.pdf --max-pages 20
```

#### Supported Formats

| Format | Extensions | Text | Tables | OCR | Metadata |
|--------|-----------|------|--------|-----|----------|
| PDF | .pdf | ✅ PyMuPDF + pdftotext | ✅ pdfplumber + tabula | ✅ Tesseract | ✅ |
| Word | .docx, .doc | ✅ python-docx | ✅ | ❌ | ✅ |
| Excel | .xlsx, .xls | ✅ openpyxl | ✅ | ❌ | ✅ |
| CSV | .csv | ✅ | ✅ | ❌ | ⚠️ |
| Images | .png, .jpg, .tiff, .bmp | ✅ OCR | ❌ | ✅ | ✅ Pillow |
| HTML | .html, .htm | ✅ BeautifulSoup | ❌ | ❌ | ⚠️ |
| Text | .txt, .md, .json, .xml | ✅ | ❌ | ❌ | ⚠️ |

#### PDF Extraction Strategy

The extractor uses a multi-strategy approach:
1. **PyMuPDF** (primary) — fastest, best for native text PDFs
2. **pdftotext** (layout mode) — preserves column layouts, spacing
3. **Tesseract OCR** (fallback) — auto-triggered when a page has 
# e.g., tesseract-ocr-deu (German), tesseract-ocr-fra (French)
```

---

## Agent Workflow

### When to use which script:

1. **"Read this PDF"** → `extract.py ` (default text mode)
2. **"Get the tables from this document"** → `extract.py  --mode tables`
3. **"What kind of document is this?"** → `analyze.py `
4. **"Extract all dollar amounts"** → `analyze.py  --extract-figures`
5. **"Is this contract safe to sign?"** → `analyze.py  --type contract`
6. **"Parse this financial statement"** → `analyze.py  --type financial`
7. **"Convert this PDF to markdown"** → `convert.py .pdf .md`
8. **"OCR this scanned document"** → `extract.py  --mode ocr`
9. **"What's on pages 5-10?"** → `extract.py  --pages 5-10`

### For large documents:
- Use `--pages` to extract specific sections
- Use `--max-pages 20` to limit processing
- Use `--mode meta` first to check page count before full extraction
- Use `--json` output for programmatic post-processing

### For scanned/image-heavy PDFs:
- Try `--mode text` first (auto-OCR fallback)
- If quality is poor, use `--mode ocr` to force full OCR
- Add `--ocr-lang eng+nor` for multi-language documents
- Use `--mode layout` for column-heavy layouts

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [JansenAnalytics](https://github.com/JansenAnalytics)
- **Source:** [JansenAnalytics/claudex](https://github.com/JansenAnalytics/claudex)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-jansenanalytics-claudex-doc-reader
- Seller: https://agentstack.voostack.com/s/jansenanalytics
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
