Converts entire PDF files into clean Markdown to allow AI models to analyze the full document content.

Install

mkdir -p .claude/skills/pdf-to-markdown && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/319" && unzip -o skill.zip -d .claude/skills/pdf-to-markdown && rm skill.zip

Installs to .claude/skills/pdf-to-markdown

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.
487 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Beginner

Key capabilities

  • Converts PDF text to structured Markdown
  • Preserves headers, tables, and ordered/unordered lists
  • Extracts images to relative paths
  • Detects multi-column layouts for correct reading order
  • Uses high-accuracy mode for table-heavy documents

How it works

It utilizes a virtual environment to execute Python parsing scripts that systematically strip PDF formatting and translate structure into markdown syntax.

Inputs & outputs

You give it
File path to the target PDF document
You get back
A markdown-formatted text file with embedded image assets

When to use pdf-to-markdown

  • Extracting documentation from manuals
  • Analyzing large PDF reports
  • Converting table-heavy PDFs to data
  • Reading entire project specs
  • Extracting images and text from PDFs

About this skill

PDF to Markdown Converter

Extract complete PDF content as structured Markdown, preserving:

  • Headers (detected by font size, converted to # tags)
  • Bold, italic, monospace formatting
  • Tables (converted to Markdown tables)
  • Lists (ordered and unordered)
  • Multi-column layouts (correct reading order)
  • Code blocks
  • Images (extracted and copied next to output with relative paths)

When to Use This Skill

USE THIS when:

  • User wants the "whole PDF" or "entire document" in context
  • Analyzing, summarizing, or discussing PDF content
  • User says "load", "read", "bring in", "extract" a PDF
  • Grepping/searching would miss context or structure
  • PDF has tables, formatting, or structure to preserve

Environment Setup

This skill uses a dedicated virtual environment at ~/.claude/skills/pdf-to-markdown/.venv/ to avoid polluting the user's working directory.

First-Time Setup (if .venv doesn't exist)

# For fast mode only (PyMuPDF):
cd ~/.claude/skills/pdf-to-markdown && uv venv .venv && uv pip install --python .venv/bin/python pymupdf pymupdf4llm

# For --docling mode (high-accuracy tables):
cd ~/.claude/skills/pdf-to-markdown && uv venv .venv && uv pip install --python .venv/bin/python pymupdf docling docling-core

# Or install everything:
cd ~/.claude/skills/pdf-to-markdown && uv venv .venv && uv pip install --python .venv/bin/python pymupdf pymupdf4llm docling docling-core

Verify Installation

# Verify fast mode:
~/.claude/skills/pdf-to-markdown/.venv/bin/python -c "import pymupdf; import pymupdf4llm; print('OK')"

# Verify docling mode:
~/.claude/skills/pdf-to-markdown/.venv/bin/python -c "import pymupdf; import docling; import docling_core; print('OK')"

Quick Start

# Convert PDF to markdown (always extracts images)
~/.claude/skills/pdf-to-markdown/.venv/bin/python ~/.claude/skills/pdf-to-markdown/scripts/pdf_to_md.py document.pdf

# Output: document.md + images/ folder (next to the .md file)

Standard Workflow

When user provides a PDF and wants full content in context:

Step 1: Ensure the skill venv exists

test -d ~/.claude/skills/pdf-to-markdown/.venv || (cd ~/.claude/skills/pdf-to-markdown && uv venv .venv && uv pip install --python .venv/bin/python pymupdf pymupdf4llm)

Step 2: Convert PDF to Markdown

~/.claude/skills/pdf-to-markdown/.venv/bin/python ~/.claude/skills/pdf-to-markdown/scripts/pdf_to_md.py "/path/to/document.pdf"

Step 3: Read the output

# Output is written to document.md in the same directory as the PDF
cat /path/to/document.md

Caching

PDFs are aggressively cached to avoid re-processing. First extraction is slow, every subsequent request is instant.

How It Works

  • Cache location: ~/.cache/pdf-to-markdown/<cache_key>/
  • Cache key: Based on file content hash + extraction mode
  • Invalidation: Cache is invalidated when:
    • Source PDF is modified (size or mtime changes)
    • Extractor version changes (automatic re-extraction)
    • Explicitly cleared with --clear-cache or --clear-all-cache

Cache Commands

# Clear cache for a specific PDF
~/.claude/skills/pdf-to-markdown/.venv/bin/python ~/.claude/skills/pdf-to-markdown/scripts/pdf_to_md.py document.pdf --clear-cache

# Clear entire cache
~/.claude/skills/pdf-to-markdown/.venv/bin/python ~/.claude/skills/pdf-to-markdown/scripts/pdf_to_md.py --clear-all-cache

# Show cache statistics
~/.claude/skills/pdf-to-markdown/.venv/bin/python ~/.claude/skills/pdf-to-markdown/scripts/pdf_to_md.py --cache-stats

Cache Contents

~/.cache/pdf-to-markdown/<cache_key>/
├── metadata.json    # source path, mtime, size, total_pages
├── full_output.md   # cached full markdown
└── images/          # extracted images

Image Handling

Images are always extracted. They are:

  1. Cached in ~/.cache/pdf-to-markdown/<cache_key>/images/
  2. Copied to images/ folder next to the output .md file
  3. Referenced in the markdown with relative paths (images/filename.png)
  4. Summarized in a table at the end of the document

Auto-View Behavior for Images

IMPORTANT: When the extracted markdown contains image references like:

**[Image: figure_1.png (1200x800, 125.3KB)]**

And the user asks about something that might be visual (charts, graphs, diagrams, figures, screenshots, layouts, designs, plots, illustrations), automatically use the Read tool to view the relevant image file(s) before answering. Don't ask the user - just look at it.

Examples of when to auto-view images:

  • User: "What does the chart on page 3 show?" → Read the image file
  • User: "Summarize the figures in this paper" → Read all image files
  • User: "What's in the diagram?" → Read the image file
  • User: "Describe the architecture shown" → Read the image file
  • User: "What are the results?" (and there's a results figure) → Read it

Output Format

The markdown output includes:

Header (metadata)

---
source: document.pdf
total_pages: 42
extracted_at: 2025-01-15T10:30:00
from_cache: true
images_dir: images
---

Content with image references

# Main Title

## Section Header

Regular paragraph text with **bold**, *italic*, and `code` formatting.

![Figure 1](images/figure_1.png)

**[Image: figure_1.png (800x600, 45.2KB)]**

| Column A | Column B |
|----------|----------|
| Data 1   | Data 2   |

Image summary table (at end)

---

## Extracted Images

| # | File | Dimensions | Size |
|---|------|------------|------|
| 1 | figure_1.png | 800x600 | 45.2KB |
| 2 | chart_2.png | 1200x800 | 89.1KB |

Script Reference

Location: ~/.claude/skills/pdf-to-markdown/scripts/pdf_to_md.py

Usage: pdf_to_md.py <input.pdf> [output.md] [options]

Options:
  --docling         Use Docling AI for high-accuracy tables (~1 sec/page)
  --no-progress     Disable progress indicator

Cache Options:
  --clear-cache        Clear cache for this PDF and re-extract
  --clear-all-cache    Clear entire cache directory and exit
  --cache-stats        Show cache statistics and exit

High-Accuracy Mode (Docling)

For PDFs with complex tables that need high accuracy, use the --docling flag:

~/.claude/skills/pdf-to-markdown/.venv/bin/python \
    ~/.claude/skills/pdf-to-markdown/scripts/pdf_to_md.py \
    document.pdf --docling

When to use --docling:

  • PDF has complex tables (borderless, merged cells, multi-column)
  • Table accuracy is critical (medical data, financial reports)
  • You're seeing garbled table output in default mode

Trade-offs:

  • ~1 second per page (vs instant for fast mode)
  • First run downloads AI models (~500MB one-time)
  • Higher-resolution images (4x default)

Note: --accurate is an alias for --docling.

Troubleshooting

"No module named pymupdf4llm" or venv doesn't exist

Recreate the skill's virtual environment:

# For fast mode:
cd ~/.claude/skills/pdf-to-markdown && rm -rf .venv && uv venv .venv && uv pip install --python .venv/bin/python pymupdf pymupdf4llm

# For docling mode:
cd ~/.claude/skills/pdf-to-markdown && rm -rf .venv && uv venv .venv && uv pip install --python .venv/bin/python pymupdf docling docling-core

Poor extraction quality

  • Try --docling for complex tables
  • For scanned PDFs, ensure Tesseract OCR is installed: brew install tesseract

Tables not formatting correctly

For complex tables, use --docling mode which uses IBM's TableFormer AI model.

Comparison with Other Approaches

ApproachUse CaseLimitations
This skill (pymupdf4llm)Full document context with imagesLarge PDFs may exceed context
--docling modeComplex tables, medical/financial PDFsSlower (~1 sec/page), larger models
Grepping PDFFind specific textLoses structure, no images
Page-by-page extractionTargeted pagesManual, loses cross-page context
Read tool on PDFQuick previewLimited formatting preservation

When not to use it

  • When the PDF is an image-only scan without OCR pre-processing
  • When performing simple searches that could be handled by basic text-grep tools

Prerequisites

uvpymupdfdocling

Limitations

  • Requires local installation of dependencies and Python environment
  • Performance depends on PDF complexity and source formatting

How it compares

It maintains internal document hierarchy and layout structure instead of producing a flat, unformatted stream of text.

Compared to similar skills

pdf-to-markdown side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
pdf-to-markdown (this skill)1,1758moReviewBeginner
markitdown1772moReviewIntermediate
marker226moReviewBeginner
baoyu-danger-x-to-markdown22moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

markitdown

K-Dense-AI

Convert various file formats (PDF, Office documents, images, audio, web content, structured data) to Markdown optimized for LLM processing. Use when converting documents to markdown, extracting text from PDFs/Office files, transcribing audio, performing OCR on images, extracting YouTube transcripts, or processing batches of files. Supports 20+ formats including DOCX, XLSX, PPTX, PDF, HTML, EPUB, CSV, JSON, images with OCR, and audio with transcription.

177310

marker

benchflow-ai

Convert PDF documents to Markdown using marker_single. Use when Claude needs to extract text content from PDFs while preserving LaTeX formulas, equations, and document structure. Ideal for academic papers and technical documents containing mathematical notation.

2248

baoyu-danger-x-to-markdown

JimLiu

Converts X (Twitter) tweets and articles to markdown with YAML front matter. Uses reverse-engineered API requiring user consent. Use when user mentions "X to markdown", "tweet to markdown", "save tweet", or provides x.com/twitter.com URLs for conversion.

28

pdf-to-md

huangyrcn

>

00

defuddle

ludotype

Extract clean markdown content from web pages using Defuddle CLI, removing clutter and navigation to save tokens. Use instead of WebFetch when the user provides a URL to read or analyze, for online documentation, articles, blog posts, or any standard web page. Do NOT use for URLs ending in .md — tho

00

second-brain

Bradliebs

Build and maintain a Karpathy-style LLM-maintained personal wiki (a "Second Brain") as plain markdown the user owns. Use when the user wants to set up a second brain, capture/ingest a source into their notes, ask their knowledge base a question, file decisions, or keep a personal wiki organized. Tri

00

Search skills

Search the agent skills registry