PDF Toolkit
Use this skill for PDFs that already exist. For CAJ-to-PDF conversion, use the separate caj-pdf skill first.
Route requests
- Compress or reduce file size:
scripts/pdf_compress.sh - Convert pages to PNG/JPG previews or long-image inputs:
scripts/pdf_render.sh - Extract text or make a
.txt:scripts/pdf_text.sh - Extract embedded images:
scripts/pdf_images.sh - OCR a scanned PDF:
scripts/pdf_ocr.sh - Merge, split, extract, or delete pages:
scripts/pdf_pages.sh
General rules
- Confirm input files exist before running scripts.
- Prefer default outputs beside the input file unless the user gives an output path.
- Do not overwrite existing outputs unless the user explicitly asks; scripts create timestamped outputs by default.
- Validate resulting PDFs with
pdfinfowhen available. - Report the final output path and the key validation result: page count, file size, or generated file count.
Quick commands
scripts/pdf_compress.sh input.pdf
scripts/pdf_render.sh input.pdf --format png --dpi 180
scripts/pdf_text.sh input.pdf --layout
scripts/pdf_images.sh input.pdf
scripts/pdf_ocr.sh input.pdf
scripts/pdf_pages.sh extract input.pdf 1-5
scripts/pdf_pages.sh merge output.pdf a.pdf b.pdf
scripts/install_deps.sh --check
Dependencies
- Compression:
gs - Rendering:
pdftoppm - Text extraction:
pdftotext - Image extraction:
pdfimages - OCR:
ocrmypdfpreferred; fallback usespdftoppm,tesseract, andqpdformutool - Page operations:
qpdfpreferred; fallback usesmutoolfor common operations
If a required dependency is missing:
- Run
scripts/install_deps.sh --check. - Show the user the missing commands and suggested package-manager command.
- Only run
scripts/install_deps.sh --installafter the user asks to install dependencies. - Do not improvise with fragile parsing.
install_deps.sh supports Homebrew on macOS and apt-get on Debian/Ubuntu. On other systems, it prints the missing command names for manual installation.