pdf

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

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/CHENHUI-X/toolbox --skill pdf-chenhui-x
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pdf
Source: https://github.com/CHENHUI-X/toolbox/tree/main/official-skills/productivity/pdf
Command: npx skills add https://github.com/CHENHUI-X/toolbox --skill pdf-chenhui-x

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pypdf, reportlab, pdfplumber, pypdfium2, pymupdf, pymupdf4llm, marker-pdf, 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: creating documents, building fillable forms, extracting text and tables, merging files, handling scanned pages, and encrypting output each require different tools and careful verification. This Skill consolidates the full PDF lifecycle into tested command-line helpers with explicit pitfalls and verification steps. ## Core Features & Use Cases - Create and build: Generate multi-page PDFs from JSON specs (headings, tables, images) and build fillable AcroForm forms with layout linting and visual overlay review before building. - Extract and inspect: Pull per-page text, tables (JSON/CSV), metadata, form-field values, and detect encrypted or scanned pages; OCR scanned documents via pymupdf or marker-pdf. - Manipulate and secure: Merge, split, rotate, watermark, stamp text/images at coordinates, manage metadata and attachments, and encrypt/decrypt with AES-256. - Use Case: You receive a scanned contract plus a digital invoice. Detect the scanned pages with pdf_read.py --meta, OCR them via the marker-pdf reference, extract the invoice tables to CSV, then merge both into one encrypted, bookmarked PDF. ## Quick Start Ask the assistant to extract all text and tables from your PDF file, or to merge several PDFs into a single 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, returning JSON or CSV output. The pdf_read.py helper wraps this: run it with --text for page text, --tables for structured rows, or --meta for metadata and page sizes.

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, lint the layout with pdf_form_layout.py, then build with pdf_make_form.py using reportlab's AcroForm support. It handles text, checkbox, radio, and dropdown fields.

pymupdf vs marker-pdf: which should I use for PDF extraction?

Use pymupdf (~25MB, instant) for text-based PDFs, tables, and metadata. Use marker-pdf (~3-5GB with PyTorch models) when you need OCR for scanned documents, equations, forms, or complex layout analysis.

Why does my PDF extraction return empty text?

Empty extraction usually means the PDF is scanned or image-only with no text layer. Check with pdf_read.py --meta for likely_scanned_pages, then render those pages to PNG and run OCR via marker-pdf instead of reporting no content.

Can pypdf flatten filled PDF forms reliably?

pypdf flattening works reliably for plain text fields and checkboxes but can drop or misrender exotic widgets like rich text, custom appearances, and some radio groups. Verify flattened output visually, and use Ghostscript as a fallback for critical cases.

Does PDF encryption with permission flags prevent copying?

No. Owner-password permission flags (no-print, no-copy) are advisory and any PDF library can strip them. Only the user password actually gates content via AES-256 encryption.