Complete Guide to PDF Manipulation Features for Claude Skills

Claude Skills includes a dedicated PDF processing skill that provides comprehensive document manipulation capabilities, from merging and OCR extraction to form filling and encryption, all accessible through plain-text instructions.

The PDF manipulation features for Claude Skills are housed in the ComposioHQ/awesome-claude-skills repository under the document-skills/pdf/ directory. This skill follows the standard Claude Skill layout with a SKILL.md file containing declarative instructions supported by reusable Python scripts in the scripts/ folder. Together, these components enable Claude to execute complex PDF operations ranging from simple page rotation to advanced table extraction and OCR processing.

PDF Skill Architecture

The PDF skill architecture separates declarative instructions from imperative implementation. The document-skills/pdf/SKILL.md file serves as the master guide that Claude references to understand available operations, while the document-skills/pdf/scripts/ directory contains executable helpers like fill_pdf_form_with_annotations.py and convert_pdf_to_images.py. When you request a PDF operation, Claude selects the appropriate skill definition and executes the underlying Python or bash implementation.

Core Document Operations

The foundational PDF manipulation features cover document restructuring and metadata handling using the pypdf library.

Merging and Splitting PDFs

Claude concatenates multiple PDFs into a single document using pypdf.PdfWriter. The implementation iterates through input files, adding all pages to a writer instance before committing to disk.

from pypdf import PdfWriter, PdfReader

writer = PdfWriter()
for pdf_file in ["invoice.pdf", "terms.pdf"]:
    reader = PdfReader(pdf_file)
    for page in reader.pages:
        writer.add_page(page)

with open("merged.pdf", "wb") as out:
    writer.write(out)

For splitting, Claude extracts individual pages or page ranges into separate files using similar pypdf primitives to isolate specific sections.

Rotating Pages and Extracting Metadata

Claude rotates PDF pages by specified angles using page.rotate(90) patterns. To extract document metadata such as title, author, and subject, Claude accesses the reader.metadata property through the PdfReader object.

Advanced Content Extraction

Beyond basic operations, Claude Skills provides sophisticated content extraction capabilities for unstructured and scanned documents.

Layout-Aware Text and Table Extraction

For text extraction preserving document layout, Claude employs pdfplumber to pull raw text while maintaining positional information. When handling tabular data, Claude uses page.extract_tables() to identify and return structured table data.

The skill extends table extraction to Excel conversion using Pandas. This advanced workflow extracts tables and converts them into combined Excel files, enabling direct data analysis in spreadsheet format.

OCR for Scanned Documents

Claude runs OCR on scanned PDFs to transform image-only documents into searchable text. The implementation combines pdf2image to convert pages to images and pytesseract to perform optical character recognition.

import pytesseract
from pdf2image import convert_from_path

images = convert_from_path('scanned.pdf')
text = ""
for i, img in enumerate(images):
    text += f"Page {i+1}:\n"
    text += pytesseract.image_to_string(img) + "\n\n"

print(text)

This workflow relies on the convert_pdf_to_images.py helper script in the document-skills/pdf/scripts/ folder.

Image Extraction

To extract embedded raster images, Claude invokes the pdfimages command-line utility, pulling visual assets from existing PDF documents without rendering overhead.

PDF Creation and Security

The skill supports not only modifying existing documents but also generating new ones and applying security controls.

Generating PDFs from Scratch

Claude creates new PDFs using reportlab, leveraging both the Canvas API for low-level drawing and Platypus for higher-level document composition. This enables generation of invoices, reports, and formatted documents programmatically as documented in SKILL.md.

Watermarking and Encryption

For document security, Claude overlays watermarks using page.merge_page(watermark) to combine watermark layers with existing content. For password protection and encryption, Claude utilizes writer.encrypt() to apply user and owner passwords, restricting document access and permissions.

Form Handling and CLI Integration

The PDF skill integrates both interactive form manipulation and external utility access for specialized processing.

Filling Interactive PDF Forms

Claude populates interactive PDF form fields through the dedicated document-skills/pdf/forms.md guide and the fill_pdf_form_with_annotations.py helper script. This capability automates field annotation and data population in standardized PDF forms using coordinate-based or field-name-based targeting.

External Command-Line Tools

For performance-critical operations, Claude can invoke external utilities including pdftotext, qpdf, and pdftk. These bash-accessible tools provide fast processing for text extraction, PDF repair, and document splitting without Python overhead.

Summary

  • The PDF manipulation features for Claude Skills are defined in document-skills/pdf/SKILL.md and supported by scripts in document-skills/pdf/scripts/.
  • Core operations use pypdf for merging, splitting, rotation, and metadata extraction via PdfWriter and PdfReader.
  • pdfplumber handles layout-aware text and table extraction, with Pandas enabling Excel export for tabular data.
  • pytesseract and pdf2image power OCR capabilities for scanned documents, managed through convert_pdf_to_images.py.
  • reportlab facilitates PDF creation from scratch, while writer.encrypt() provides native security features.
  • Form filling leverages fill_pdf_form_with_annotations.py and external CLI tools extend processing capabilities for specialized workflows.

Frequently Asked Questions

How do I extract tables from a PDF into Excel using Claude Skills?

Claude Skills processes table extraction using page.extract_tables() from pdfplumber, then converts the results to Excel format using Pandas. Reference the table extraction section in document-skills/pdf/SKILL.md and request Claude to extract tables from a specific PDF to trigger this workflow, which outputs a combined Excel file.

Can Claude Skills perform OCR on scanned PDF documents?

Yes, Claude Skills includes OCR capabilities through the pytesseract and pdf2image libraries. The process converts PDF pages to images using convert_from_path(), then applies image_to_string() to extract searchable text. The scripts/convert_pdf_to_images.py helper automates the image conversion portion of this pipeline.

What file handles interactive PDF form filling in Claude Skills?

Interactive form filling is documented in document-skills/pdf/forms.md and implemented via scripts/fill_pdf_form_with_annotations.py. This script automates field annotation and population, allowing Claude to programmatically fill PDF forms using the annotations layer.

Is password encryption available for PDFs in Claude Skills?

Yes, Claude Skills supports password protection and encryption using pypdf. The implementation calls writer.encrypt() to apply user and owner passwords to PDF documents. This restricts opening, editing, or printing based on the encryption parameters specified in the skill instructions.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →