pdf

Extract, merge, split, create, and fill PDF documents using Python libraries and command-line tools.

Updated Feb 4, 2026
One-click install
npx skills add https://github.com/pchemguy/AISandbox --skill pdf-pchemguy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pdf
Source: https://github.com/pchemguy/AISandbox/tree/main/docs/AgentSkills/anthropics/skills/skills/pdf
Command: npx skills add https://github.com/pchemguy/AISandbox --skill pdf-pchemguy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pypdf, pdf2image, Pillow, and includes scripts (resource) and references (resource) components.

What problem does it solve? Working with PDF files programmatically is fragmented across many libraries and tools, and filling PDF forms—especially non-fillable ones—requires tedious manual coordinate mapping. This Skill consolidates PDF manipulation into one toolkit with ready-to-run scripts and step-by-step workflows. ## Core Features & Use Cases - Text, Table & Metadata Extraction: Pull text, structured tables, and document metadata using pypdf, pdfplumber, and poppler-utils, with OCR support for scanned documents. - PDF Creation & Manipulation: Merge, split, rotate, encrypt, watermark, and generate new PDFs with reportlab, qpdf, and pdf-lib. - Automated Form Filling: Detect fillable form fields, extract field metadata to JSON, and fill them programmatically; for non-fillable forms, visually map bounding boxes and inject text annotations with validation. - Use Case: You receive a stack of non-fillable government PDF forms. The Skill converts pages to images, guides bounding-box validation, and produces accurately filled PDFs without manual editing. ## Quick Start Ask the assistant to extract all tables from your PDF into an Excel file, or to fill in a PDF form you provide.

Frequently Asked Questions about pdf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract tables from a PDF in Python?▼

Use pdfplumber's page.extract_tables() method to detect and extract tables from each page. The results can be loaded into pandas DataFrames and exported to Excel or CSV for further analysis.

How do I fill a PDF form programmatically?▼

First run check_fillable_fields.py to detect fillable fields. If fields exist, extract them with extract_form_field_info.py and fill them via fill_fillable_fields.py; otherwise map bounding boxes visually and add text annotations.

Which Python library should I use for PDF text extraction?▼

pdfplumber is best for text with layout and tables, while pypdf handles basic text, metadata, merging, and encryption. For scanned PDFs, use pdf2image with pytesseract for OCR.

Can I extract text from a scanned PDF?▼

Scanned PDFs contain images, not text layers, so standard parsers fail. Convert pages to images with pdf2image, then run pytesseract OCR on each image to recover the text.

How do I merge or split PDFs from the command line?▼

Use qpdf: 'qpdf --empty --pages file1.pdf file2.pdf -- merged.pdf' merges files, and page ranges like '1-5' split documents. Alternatively, pypdf's PdfWriter performs the same operations in Python.

Why does my filled PDF form not display values in some viewers?▼

Some viewers need the NeedAppearances flag set to render form values correctly. The fill_fillable_fields.py script calls set_need_appearances_writer(True) to handle this, though viewers may show a save prompt.