pdf

Create, read, merge, fill, and encrypt PDF files using pypdf, reportlab, and pdfplumber.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/xiaoshan1234/ai-skill --skill pdf-xiaoshan1234
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pdf
Source: https://github.com/xiaoshan1234/ai-skill/tree/main/role/doc-assistant/skills/pdf
Command: npx skills add https://github.com/xiaoshan1234/ai-skill --skill pdf-xiaoshan1234

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Working with PDFs programmatically is fragmented across many libraries and edge cases: generating documents, building fillable forms, extracting text and tables, merging pages, and handling encryption each require different tools and careful validation. This Skill consolidates those operations into tested command-line scripts with built-in layout linting, scanned-page detection, and verification steps. ## Core Features & Use Cases - PDF generation and forms: Build multi-page documents from JSON specs with reportlab, and create fillable AcroForm forms (text, checkbox, radio, dropdown) with a layout linter and visual overlay review before building. - Extraction and inspection: Pull per-page text, tables (JSON/CSV), metadata, and form-field values with pdfplumber and pypdf, including automatic detection of encrypted and image-only (scanned) pages. - Manipulation and security: Merge, split, rotate, watermark, stamp text/images at coordinates, manage metadata and attachments, and encrypt/decrypt with AES-256. - Use Case: You receive a stack of contracts as PDFs. Inspect each with metadata flags, extract key tables to CSV, merge selected pages into one summary document, stamp it "DRAFT", and encrypt the result with a password — all through scriptable CLI commands. ## Quick Start Ask the assistant to extract all text and tables from your PDF file, or to merge several PDFs into one document with bookmarks.

Frequently Asked Questions about pdf

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

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

Use pdfplumber for per-page text and table extraction, which detects tables from ruling lines and word alignment. The pdf_read.py script outputs text as JSON per page and tables as JSON arrays, with an option to also write CSV files.

How do I create a fillable PDF form programmatically?▼

Define fields in a JSON spec with label_box and entry_box coordinates in PDF points, then build it with reportlab's acroForm supporting text, checkbox, radio, and dropdown fields. Lint the layout first with pdf_form_layout.py to catch overlaps and out-of-bounds boxes before building.

Can pypdf extract text from scanned PDF documents?▼

No, scanned PDFs are image-only and contain no text layer, so pypdf and pdfplumber return empty text. Export the pages as PNG images and process them with an OCR skill instead of treating empty output as no content.

Does PDF encryption with owner passwords prevent copying?▼

No, owner-password permission flags like no-print or no-copy are advisory and any PDF library can strip them. Only the user password actually gates content through AES-256 encryption.

Why does PDF form flattening lose field values?▼

pypdf's flattening merges widget appearances into page content, which works for plain text fields and checkboxes but can drop or misrender exotic widgets like rich text or some radio groups. Verify flattened output visually and use an external renderer like Ghostscript for critical cases.

How do I merge multiple PDFs and add bookmarks?▼

Use pypdf to append pages from each input file in order, optionally adding one top-level bookmark per source file named after its basename. Encrypted inputs must be decrypted first before merging.