fenix-skills/skills/extract-pdf-pages/SKILL.md

33 lines
1.1 KiB
Markdown

---
name: extract-pdf-pages
description: 'Use when the user invokes "/extract-pdf-pages" to extract a page range from a PDF file using pdftk.'
tools: Bash
disable-model-invocation: true
---
# Extract PDF Pages
Extract a page range from a PDF file into a new PDF using `pdftk`.
## Usage
When invoked, ask the user for (if not already provided):
1. **Source PDF** — absolute path to the input PDF file
2. **Page range** — start and end pages (e.g., `200-204`)
3. **Output filename** — name for the new PDF (defaults to current working directory)
## Command
```bash
pdftk "<source_pdf>" cat <start>-<end> output "<output_path>"
```
## Rules
- Always use absolute paths for both source and output files.
- If the user provides only a filename (no directory), place the output in the current working directory.
- If the output file already exists, warn the user before overwriting.
- Support multiple extractions in a single invocation (run them in parallel).
- After extraction, confirm with file size: `ls -lh "<output_path>"`
- Requires `pdftk` to be installed (`apt install pdftk`).