SkillsGrove
SkillsGrove/문서 작업/jholhewres/devclaw-skills/pdf-tools

pdf-tools

설치

$npx skills add https://github.com/jholhewres/devclaw-skills --skill pdf-tools
$git clone --depth 1 https://github.com/jholhewres/devclaw-skills.git /tmp/devclaw-skills && mkdir -p ~/.claude/skills && cp -r /tmp/devclaw-skills/skills/pdf-tools ~/.claude/skills/pdf-tools
이 Agent Skill을 설치해 주세요: https://github.com/jholhewres/devclaw-skills/tree/0177c36eb6dcdfe3f891fd332ef538a3d84cc693/skills/pdf-tools — 먼저 SKILL.md와 스크립트를 읽고, 안전하다고 확인한 뒤에만 제 skills 폴더에 설치해 주세요.

요약

원문 설명 · MITPDF manipulation — merge, split, compress, convert, and modify PDFs
아래 SKILL.md는 jholhewres/devclaw-skills(커밋 0177c36)에서 MIT 라이선스에 따라 게시한 것입니다. 본문은 변경하지 않았으며, 파일 상단의 메타데이터만 생략하고 이미지는 링크로 표시하며 매우 긴 파일은 일부만 표시합니다. Copyright 2026 DevClaw. 라이선스: LICENSE. 지침 파일만 표시되며 스크립트 등은 원본 저장소를 참고하세요.

PDF Tools

Manipulate PDF files using command-line tools.

Setup

# Ubuntu/Debian
sudo apt install qpdf pdftk ghostscript poppler-utils

# macOS
brew install qpdf pdftk-java ghostscript poppler

Merge PDFs

# Merge multiple PDFs
qpdf --empty --keep-temporary-files page1.pdf page2.pdf page3.pdf -- merged.pdf

# With pdftk
pdftk page1.pdf page2.pdf page3.pdf cat output merged.pdf

# Merge all PDFs in directory
pdftk *.pdf cat output all_merged.pdf

Split PDFs

# Extract pages 1-5
qpdf input.pdf --pages . 1-5 -- output.pdf

# Extract single page
pdftk input.pdf cat 3 output page3.pdf

# Split into individual pages
pdftk input.pdf burst output page_%d.pdf

# Extract range
qpdf input.pdf --pages . 5-10 -- extracted.pdf

Compress PDF

# Compress with Ghostscript (best quality)
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook \
   -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed.pdf input.pdf

# PDF settings options:
# /screen   - 72 dpi, smallest size, lowest quality
# /ebook    - 150 dpi, medium size, good quality
# /printer  - 300 dpi, larger size, high quality
# /prepress - 300 dpi, highest quality

# Quick compress with qpdf
qpdf --compress-streams=y --recompress-flate input.pdf compressed.pdf

Rotate PDF

# Rotate all pages 90 degrees clockwise
pdftk input.pdf cat 1-endright output rotated.pdf

# Rotate specific pages
qpdf input.pdf --rotate=+90:1,3,5 output.pdf

# Rotation options: +90, +180, +270, -90

Add Watermark

# Add text watermark with pdftk
pdftk input.pdf background watermark.pdf output watermarked.pdf

# Create watermark PDF first
echo "DRAFT" | enscript -B -f Courier-Bold100 -o - | ps2pdf - watermark.pdf

Password Protect

# Add password (owner + user)
qpdf --encrypt user_pass owner_pass 256 -- input.pdf protected.pdf

# With pdftk
pdftk input.pdf output protected.pdf encrypt_128bit owner_pw owner_pass user_pw user_pass

Remove Password

# Remove password (requires password)
qpdf --password=yourpass --decrypt protected.pdf unlocked.pdf

# With pdftk
pdftk protected.pdf input_pw yourpass output unlocked.pdf

PDF to Images

# Convert PDF to images (each page)
pdftoppm input.pdf output -png

# Specific page
pdftoppm -f 1 -l 1 input.pdf output -png

# Set resolution (DPI)
pdftoppm -rx 300 -ry 300 input.pdf output -png

Images to PDF

# Convert images to PDF
convert image1.png image2.png output.pdf

# Or with img2pdf (better quality)
img2pdf image1.png image2.png -o output.pdf

Extract Text

# Extract text from PDF
pdftotext input.pdf output.txt

# Keep layout
pdftotext -layout input.pdf output.txt

# Extract from specific pages
pdftotext -f 1 -l 5 input.pdf output.txt

Remove Metadata

# Strip all metadata
qpdf --linearize input.pdf clean.pdf
exiftool -all:all= clean.pdf

# Or with Ghostscript
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH \
   -sOutputFile=clean.pdf input.pdf

Tips

  • Use qpdf for most operations (faster, more reliable)
  • Use pdftk for complex page manipulations
  • Use Ghostscript for compression
  • Always backup before modifying important PDFs

Triggers

pdf, merge pdf, split pdf, compress pdf, pdf tools, pdf merge, password pdf, watermark pdf

라이선스 전문 보기(MIT)
MIT License

Copyright (c) 2026 DevClaw

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.