A comprehensive OpenClaw skill for viewing, extracting, editing, and manipulating PDF files using Python libraries (pdfplumber, PyPDF2, and reportlab).
- π Text Extraction - Extract text from entire PDFs or specific pages
- βοΈ Text Editing - Add text overlays to PDF pages with custom positioning and font size
- π PDF Info - View metadata, page count, dimensions, and document properties
- π Merge PDFs - Combine multiple PDF files into one
- βοΈ Split PDFs - Split by individual pages or custom page ranges
- π Rotate Pages - Rotate pages at 90Β°, 180Β°, 270Β°, or -90Β° angles
Install required Python packages:
pip3 install pdfplumber PyPDF2 reportlab
- Download
pdf-tools-clawhub.zip - Extract to your OpenClaw skills directory:
unzip pdf-tools-clawhub.zip -d ~/.openclaw/workspace/skills/ mv ~/.openclaw/workspace/skills/pdf-tools-for-clawhub ~/.openclaw/workspace/skills/pdf-tools
- The skill will be automatically loaded by OpenClaw
Simply ask your OpenClaw agent:
- "Extract text from this PDF"
- "Add 'CONFIDENTIAL' text to page 1"
- "Rotate pages 1-3 by 90 degrees"
- "Merge these 3 PDF files"
- "Split this PDF into separate pages"
- "Show me info about this PDF"
The agent will automatically use the appropriate script!
scripts/extract_text.py document.pdf scripts/extract_text.py document.pdf -p 1 3 5 scripts/extract_text.py document.pdf -o output.txt
Add text overlay:
scripts/edit_text.py input.pdf -o output.pdf --overlay "New Text" --page 1 --x 100 --y 700 scripts/edit_text.py input.pdf -o output.pdf --overlay "Watermark" --page 1 --x 200 --y 400 --font-size 20
Replace text (limited due to PDF format complexity):
scripts/edit_text.py input.pdf -o output.pdf --replace "Old Text" "New Text"
Note: Text overlay is more reliable than replacement due to PDF format complexity.
scripts/pdf_info.py document.pdf scripts/pdf_info.py document.pdf -f json
scripts/merge_pdfs.py file1.pdf file2.pdf file3.pdf -o merged.pdf
Split into individual pages:
scripts/split_pdf.py document.pdf -o output_dir/
Split by page ranges:
scripts/split_pdf.py document.pdf -o output_dir/ -m ranges -r "1-3,5-7,10-12"scripts/rotate_pdf.py document.pdf -o rotated.pdf -r 90 scripts/rotate_pdf.py document.pdf -o rotated.pdf -r 180 -p 1 3 5
For detailed library documentation and advanced patterns, see references/libraries.md.
# Extract text scripts/extract_text.py original.pdf -o extracted.txt # Translate the text (using your preferred method) # ... # Create new PDF with translated text (requires custom script or reportlab)
# For each page, add overlay with watermark text scripts/edit_text.py input.pdf -o watermarked.pdf --overlay "DRAFT" --page 1 --x 300 --y 400 --font-size 48
- Page numbers are 1-indexed in all scripts (page 1 = first page)
- Text extraction works best with text-based PDFs (not scanned images)
- Rotation angles must be 90, 180, 270, or -90 (counterclockwise)
- Text editing uses overlay method (more reliable) or simple replacement (limited)
- Cyrillic support requires fonts like DejaVuSans or Liberation (auto-detected)
- PDF text replacement is limited due to format complexity (encoding, positioning, fonts)
- For complex text editing, consider: extract β edit β regenerate PDF
- Scanned PDFs require OCR for text extraction (not included)
Found a bug or have a feature request? Please report it on the OpenClaw community forums or GitHub.
MIT License - feel free to modify and distribute.
Created by @cmpdchtr