# PDF

> Use when the user needs to read, extract, merge, split, rotate, create, watermark, encrypt, or OCR a PDF file.

- Skill: `vathymut/pdf` (Agent Skill, multi-file: 13 files)
- Install (CLI): `npx skillmds@latest add vathymut/pdf`
- Raw SKILL.md: https://api.skillmd.com/api/skills/vathymut/pdf/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: vathymut (https://skillmd.com/u/vathymut)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/vathymut/pdf

---


Process PDFs by identifying the operation, selecting the right tool, implementing, and verifying output.

## When NOT to use

- The task is pure image processing (no PDF involved) — use image-specific tools instead.
- The PDF is a scanned image where no text extraction is needed — the skill handles OCR internally, but if you only need image manipulation of extracted pages, route differently.

## 1. Identify the operation

Determine what the user wants to do:
- **Read/extract:** text, tables, metadata, images
- **Transform:** merge, split, rotate, watermark, encrypt/decrypt
- **Create:** new PDFs from scratch or from other formats
- **OCR:** scanned PDFs that need text recognition

## 2. Select library or tool

Choose based on the operation:

| Operation | Primary tool | Alternative |
|-----------|-------------|-------------|
| Read/extract text | pdfplumber | pypdf |
| Extract tables | pdfplumber + pandas | — |
| Merge/split/rotate | pypdf | qpdf (CLI) |
| Create PDFs | reportlab | — |
| OCR | pytesseract + pdf2image | — |
| Forms | pypdf | pdf-lib (JS) |
| Encrypt/decrypt | pypdf | qpdf (CLI) |

Check that the library is installed; install if missing. For the **forms** workflow (detect fillable fields, extract field info, fill, annotate), use `pypdf` field APIs directly (`AcroForm` / `update_page_form_field_values`). If a bundled `forms.md` reference is added to this skill in the future, load it for `scripts/` helpers. Advanced / second-tier libraries (`pypdfium2`, etc.) are documented in `references/` when present.

### Common code snippet (use directly for routine work)

**Read text with pdfplumber:**
```python
import pdfplumber
with pdfplumber.open("input.pdf") as pdf:
    for page in pdf.pages:
        print(page.extract_text())
```

All other snippets (merge, split, rotate, watermark, encrypt, create, OCR, CLI tools) live in [`references/code-snippets.md`](references/code-snippets.md).

## 3. Implement the operation

Write a script that:
- Reads input PDF(s) with the selected library
- Performs the operation
- Writes output to the specified location
- Handles errors (missing files, corrupt PDFs, permission issues)

## 4. Verify output

- Confirm the output file exists and is non-empty
- Spot-check content (e.g., page count, extracted text sample, table row count)
- Report results to the user

## Completion criteria

- [ ] Operation type and input/output files identified
- [ ] Tool selected and available in the environment
- [ ] Script runs without errors
- [ ] Output file exists and is non-empty
- [ ] Content spot-checked (page count, text sample, table row count)
- [ ] User informed of results

## Related skills

- `xlsx` — sibling file-doc skill (share zero-error bar).
- `data-access` — read `.pdf` table via DuckDB fallback when needed.

