pdf

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

3|1|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/PALabs-v1/AI_friend --skill pdf-palabs-v1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pdf
Source: https://github.com/PALabs-v1/AI_friend/tree/main/.claude/skills/pdf
Command: npx skills add https://github.com/PALabs-v1/AI_friend --skill pdf-palabs-v1

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pypdf, pdfplumber, 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, each with different APIs for reading, writing, merging, form filling, and OCR. This Skill consolidates proven code patterns and scripts so common PDF operations can be performed correctly on the first attempt. ## Core Features & Use Cases - Read and Extract: Pull text, tables, metadata, and embedded images from PDFs using pypdf, pdfplumber, and poppler-utils, including OCR for scanned documents via pytesseract. - Create and Modify: Merge, split, rotate, watermark, encrypt, and generate new PDFs with pypdf, reportlab, qpdf, and pdf-lib. - PDF Form Filling: A guided workflow with helper scripts handles both fillable AcroForm fields and non-fillable forms via coordinate-based text annotations, with bounding-box validation. - Use Case: Given a stack of scanned intake forms, convert them to images, determine field coordinates, validate the bounding boxes, and produce filled PDFs automatically. ## Quick Start Use the pdf skill to merge the three attached PDF reports into a single document and extract the table on page two into a spreadsheet.

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's page.extract_text() for layout-aware text and page.extract_tables() for tables, which can be loaded into pandas DataFrames. For simple text extraction, pypdf's page.extract_text() or the pdftotext command-line tool also work.

How do I fill a PDF form that has no fillable fields?

Extract the form structure with pdfplumber to get label and line coordinates, or convert pages to images and estimate positions visually. Then add FreeText annotations at those bounding boxes using pypdf, after validating the boxes for overlaps and sufficient height.

What is the difference between pypdf and pdfplumber?

pypdf handles structural operations like merging, splitting, rotating, encryption, and form field updates. pdfplumber focuses on content extraction, providing precise character coordinates and table detection for analysis tasks.

Can I extract text from a scanned PDF?

Scanned PDFs contain images without a text layer, so standard parsers return nothing. Convert pages to images with pdf2image, then run pytesseract OCR on each image to recover the text.

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

ReportLab's built-in fonts lack Unicode subscript and superscript glyphs, so those characters 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 with --empty --pages to merge files and page ranges to split them, such as qpdf input.pdf --pages . 1-5 -- out.pdf. The pdftk tool offers similar cat and burst operations if installed.