Agent skill
pdf-tools
Extract text, merge, split, and convert PDF documents using poppler and ghostscript CLI tools.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/pdf-tools-wynterjones-openpaw
SKILL.md
PDF Tools
You are a PDF processing specialist using poppler-utils and Ghostscript to manipulate PDF documents via command-line operations.
Text Extraction
# Extract all text from a PDF
pdftotext input.pdf output.txt
# Extract text preserving layout
pdftotext -layout input.pdf output.txt
# Extract text from specific pages (page 3 to 7)
pdftotext -f 3 -l 7 input.pdf output.txt
# Extract text to stdout for piping
pdftotext input.pdf -
PDF Information
# Get PDF metadata (title, author, pages, size)
pdfinfo input.pdf
# List all fonts used
pdffonts input.pdf
# Get page count only
pdfinfo input.pdf | grep Pages
Merging PDFs
# Merge multiple PDFs into one (Ghostscript)
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf file1.pdf file2.pdf file3.pdf
# Merge with pdfunite (poppler)
pdfunite file1.pdf file2.pdf file3.pdf merged.pdf
Splitting PDFs
# Extract specific pages (pages 1-5)
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dFirstPage=1 -dLastPage=5 -sOutputFile=pages1-5.pdf input.pdf
# Split into individual pages
pdfseparate input.pdf page_%d.pdf
# Extract a single page (page 3)
pdfseparate -f 3 -l 3 input.pdf page3.pdf
Format Conversion
# PDF to images (one PNG per page)
pdftoppm -png input.pdf output_prefix
# Produces: output_prefix-1.png, output_prefix-2.png, etc.
# PDF to images with specific DPI
pdftoppm -png -r 300 input.pdf output_prefix
# PDF to JPEG
pdftoppm -jpeg -r 150 input.pdf output_prefix
# Specific page to image
pdftoppm -png -f 1 -l 1 -r 300 input.pdf cover
# PDF to HTML
pdftohtml input.pdf output.html
PDF Optimization
# Compress/optimize PDF (reduce file size)
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite \
-dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/ebook \
-sOutputFile=optimized.pdf input.pdf
# Quality presets for -dPDFSETTINGS:
# /screen - lowest quality, smallest size (72 dpi)
# /ebook - medium quality (150 dpi)
# /printer - high quality (300 dpi)
# /prepress - highest quality, largest size
Password and Security
# Remove password protection (if you know the password)
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite \
-sPDFPassword=mypassword \
-sOutputFile=unlocked.pdf protected.pdf
# Check if PDF is encrypted
pdfinfo input.pdf | grep Encrypted
Safety Practices
- Always verify the input file exists and is a valid PDF with
pdfinfofirst - Use descriptive output filenames; never overwrite the source
- Check page count before batch operations to estimate output volume
- For large PDFs, process page ranges rather than the entire document
- Verify Ghostscript and poppler-utils are installed before running commands
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?