---
name: pdf-skill
description: "Read, extract, merge, split, OCR, and fill PDF forms — all from a single Claude skill. Anthropic's official PDF handler. Reads scanned and digital PDFs, extracts text and tables, merges/splits documents, rotates pages, fills forms, runs OCR for image-only PDFs, and creates new PDFs from content."
license: MIT
---

# PDF Skill

The official Anthropic PDF handler for Claude. It reads both digital and scanned PDFs, pulls out text and tables, restructures documents (merge, split, rotate, watermark, encrypt), fills interactive forms, and runs OCR on image-only pages so they become searchable. If your work touches a `.pdf` at any point — as a source to read or a file to produce — this is the skill that handles it.

## When to use it

- A vendor sends a 60-page contract and you need clause text or a specific table extracted.
- You have a stack of scanned receipts or invoices with no embedded text and need them OCR'd into searchable, copyable content.
- You need to combine several PDFs into one, pull pages 4–9 into a separate file, or rotate sideways-scanned pages upright.
- An AcroForm (tax form, application, intake sheet) needs its fields populated programmatically rather than by hand.
- You want to generate a clean PDF from Markdown, HTML, or extracted data.

## How it works

The skill leans on the standard Python PDF stack rather than a bespoke API:

- **Text & tables**: `pdfplumber` for layout-aware extraction (`page.extract_text()`, `page.extract_tables()`), with `pypdf` as a lighter fallback.
- **Page operations**: `pypdf`'s `PdfReader` / `PdfWriter` for merge, split, `rotate(90)`, `add_page`, and `encrypt(password)`.
- **Forms**: detects AcroForm fields and writes values via `update_page_form_field_values`, setting `NeedAppearances` so viewers render them.
- **OCR**: rasterizes pages, runs `tesseract`, and re-embeds a text layer for scanned documents.
- **Creation**: builds new PDFs from content using `reportlab` / HTML-to-PDF.

You don't call these directly — you describe the goal and Claude selects the right operation.

## Example

Then just ask:

```
Merge invoice_jan.pdf and invoice_feb.pdf, then extract every
table into a CSV. Also OCR scanned_receipt.pdf and tell me the total.
```

Claude merges with `pypdf`, extracts tables via `pdfplumber`, OCRs the scanned file, and returns the parsed total.

## Tips & gotchas

- **OCR is the slow path.** Image-only PDFs require rasterization + Tesseract per page; a digital PDF with a real text layer is far faster, so don't force OCR when text already exists.
- **Tables vary by source.** `extract_tables()` works best on ruled grids. For tables held together only by whitespace, mention the columns so extraction can be tuned.
- **Encrypted inputs need the password up front** — supply it, or decryption fails before any other step runs.
- **Filled-form values may look blank** in some viewers until `NeedAppearances` is honored; the skill sets this, but flatten the form if you need guaranteed rendering.

## FAQ

**Does it handle scanned documents with no text layer?**
Yes — that's what the OCR path is for. It detects image-only pages and reconstructs a searchable text layer.

**Can it fill out a government tax form?**
If the PDF has real AcroForm fields, yes. Flat PDFs with no field objects can't be filled programmatically and need overlay placement instead.

**Will tables keep their structure?**
Row/column structure is preserved for ruled tables and can be exported to CSV or Markdown; heavily merged cells may need manual review.
