pdf

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

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/chhpt/skills --skill pdf-chhpt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pdf
Source: https://github.com/chhpt/skills/tree/main/skills/pdf
Command: npx skills add https://github.com/chhpt/skills --skill pdf-chhpt

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pypdf, pdfplumber, pdf2image, Pillow, pytesseract, reportlab, pypdfium2, 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, making tasks like text extraction, merging, form filling, and OCR error-prone and time-consuming without clear guidance. ## Core Features & Use Cases - PDF Manipulation: Merge, split, rotate, encrypt, decrypt, and watermark PDFs using pypdf, qpdf, and pdftk. - Content Extraction: Extract text, tables, images, and metadata with pdfplumber, pdftotext, and pdfimages, including OCR for scanned documents via pytesseract. - PDF Creation & Form Filling: Generate new PDFs with reportlab and fill both fillable and non-fillable PDF forms using dedicated scripts with coordinate validation. - Use Case: Given a stack of scanned vendor invoices, convert them to images, run OCR to extract text, and compile the results into a searchable document. ## Quick Start Use the pdf skill to merge the three attached PDF reports into a single combined document.

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 to extract text with layout preserved and to detect tables via page.extract_tables(). For plain text only, pdftotext from poppler-utils is faster, and results can be converted to pandas DataFrames or Excel files.

How do I fill out a PDF form programmatically?

First run check_fillable_fields.py to detect fillable fields. For fillable PDFs, extract field info and use fill_fillable_fields.py with a JSON of values; for non-fillable PDFs, add text annotations at computed coordinates using fill_pdf_form_with_annotations.py.

Which Python library should I use for PDF tasks: pypdf, pdfplumber, or reportlab?

pypdf handles merging, splitting, rotating, and encryption. pdfplumber is best for text and table extraction with layout. reportlab creates new PDFs from scratch, while pypdfium2 handles fast page rendering to images.

Can I extract text from a scanned PDF?

Scanned PDFs contain images without a text layer, so standard parsers fail. Convert pages to images with pdf2image, then run OCR with pytesseract to produce searchable text.

Why do subscript or superscript characters render as black boxes in reportlab PDFs?

ReportLab's built-in fonts lack Unicode subscript and superscript glyphs, so they render as solid boxes. Use the <sub> and <super> XML tags inside Paragraph objects instead of Unicode characters.

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

Use qpdf: merge with 'qpdf --empty --pages file1.pdf file2.pdf -- merged.pdf' and split page ranges with 'qpdf input.pdf --pages . 1-5 -- out.pdf'. pdftk offers similar cat and burst operations if installed.