# PDF Official

Use this skill whenever a PDF file is being produced, opened, transformed, filled, or...

- Repository: https://github.com/XiaomiMiMo/MiMo-Code (13741 stars)
- Category: Documents
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add XiaomiMiMo/MiMo-Code --skill pdf-official -g -a claude-code -y`
Codex: `npx skills add XiaomiMiMo/MiMo-Code --skill pdf-official -g -a codex -y`
Cursor: `npx skills add XiaomiMiMo/MiMo-Code --skill pdf-official -g -a cursor -y`
Gemini CLI: `npx skills add XiaomiMiMo/MiMo-Code --skill pdf-official -g -a gemini-cli -y`

## Description

Use this skill whenever a PDF file is being produced, opened, transformed, filled, or read. That includes: extracting text or tables from an existing PDF; combining, carving, rotating, cropping, or watermarking pages; composing a fresh PDF (report, invoice, certificate); filling AcroForm fields or overlaying text onto a non-fillable scanned form; encrypting or unlocking a PDF; running OCR over a scanned document; rendering pages to PNG/JPEG for visual analysis. Trigger on mentions of 'PDF', a filename ending in .pdf, requests like 'turn this into a PDF report', or references to AcroForm / form fields.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# PDF skill

An Apache-2.0 toolkit for reading, composing, transforming, and filling PDF
files. Written from scratch on top of permissively-licensed open-source
libraries (pypdf, pdfplumber, pypdfium2, reportlab, pdf-lib, qpdf) so this
can be embedded in commercial projects without special agreement.

## Route the task

Pick the sub-guide by the *verb* of the request.

| Task | Path | Read |
|------|------|------|
| Pull text / tables / metadata / images out of an existing PDF | Extract | [`extract.md`](extract.md) |
| Combine, carve, rotate, crop, watermark, encrypt, or shrink | Transform | [`transform.md`](transform.md) |
| Build a PDF that doesn't exist yet (report, invoice, certificate) | Compose | [`compose.md`](compose.md) |
| Fill a form (AcroForm or scanned) | Interactive | [`interactive.md`](interactive.md) |
| Scanned / image-only PDF (no selectable text) | Extract → *OCR* | [`extract.md`](extract.md) §5 |

If a task mixes several of these, follow the order:
**probe → plan → extract or compose → validate.**

Every path starts with a probe. `scripts/survey.py` returns page count,
whether the file is encrypted, whether it has an AcroForm, and whether
page 1 looks like a scan.

## First install

> **Bundled runtime:** when the `MIMO_PYTHON` environment variable is set, skip the installs below, run every command with `python3`/`uv run` replaced by `"$MIMO_PYTHON"` (pypdf/pypdfium2/reportlab/Pillow preinstalled; pip console scripts unavailable, use `"$MIMO_PYTHON" -m <module>`). A bundled qpdf is exposed as `MIMO_QPDF` (picked up automatically by the scripts here); invoke it directly as `"$MIMO_QPDF" --check file.pdf`.

Python-only path (all BSD / MIT / Apache), covers 95% of tasks:

```bash
python3 -m pip install --upgrade pypdf pdfplumber pypdfium2 reportlab Pillow
```

Add these external binaries only when you actually need them:

The rest: https://github.com/XiaomiMiMo/MiMo-Code/blob/HEAD/packages/cli/src/skill/builtin/.bundle/pdf-official/SKILL.md
