CommunityCoding & Developmentgithub.com

PDF Processing Guide

A comprehensive reference for PDF manipulation in Python using pypdf, pdfplumber, reportlab, and OCR tools, plus CLI utilities.

What is PDF Processing Guide?

This skill provides a detailed quick-reference guide for processing PDF files programmatically in Python and via command-line tools. It covers four major Python libraries: **pypdf** for merging, splitting, rotating, watermarking, and encrypting PDFs; **pdfplumber** for reliable text and table extraction; **reportlab** for creating new PDFs from scratch; and **pytesseract + pdf2image** for OCR on scanned documents. For CLI-based workflows, it highlights `pdftotext` (with layout preservation), `qpdf` (merge/split/decrypt), and `pdftk` (burst/merge/rotate). A handy quick-reference table maps common tasks (text extraction, table extraction, merging, splitting, creation, OCR, watermarking, password protection) to the best tool and its key API. The skill is designed to be used in AI agents like Claude Code, Cursor, or Codex as a compact, actionable reference without needing to search the web. It supports any environment where Python or these CLI tools are installed, and it accepts user arguments via `$ARGUMENTS` to customize the request.

Works with✓Claude Code~Codex CLI~Cursor
npx skills add zjie64821-ui/zhangjies-skills-and-mcp

Installed? Explore more Coding & Development skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

What does PDF Processing Guide do?

Python Libraries

  • pypdf: merge (PdfWriter.add_page()), split, rotate, metadata, encrypt (writer.encrypt()), watermark (page.merge_page())
  • pdfplumber: text extraction (page.extract_text()), table extraction (page.extract_tables() → pandas)
  • reportlab: create PDFs (Canvas for simple, Platypus/SimpleDocTemplate for multi-page)
  • pytesseract + pdf2image: OCR scanned PDFs (convert_from_path() → image_to_string())

CLI Tools

  • pdftotext (poppler): text extraction, -layout preserves layout
  • qpdf: merge (qpdf --empty --pages), split, rotate, decrypt
  • pdftk: merge, split (burst), rotate

Quick Reference

TaskBest ToolKey API
Extract textpdfplumberpage.extract_text()
Extract tablespdfplumberpage.extract_tables() → DataFrame
MergepypdfPdfWriter().add_page()
Splitpypdfiterate reader.pages
CreatereportlabSimpleDocTemplate / Canvas
OCRpytesseractconvert_from_path() → image_to_string()
Watermarkpypdfpage.merge_page()
Passwordpypdfwriter.encrypt()

User Request

$ARGUMENTS

Related Skills