pdf

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

6|1|Updated Sep 3, 2026
One-click install
npx skills add https://github.com/jasonzhu0922-sketch/agentloop --skill pdf-jasonzhu0922-sketch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pdf
Source: https://github.com/jasonzhu0922-sketch/agentloop/tree/main/packages/agentloop-skills/skills/pdf
Command: npx skills add https://github.com/jasonzhu0922-sketch/agentloop --skill pdf-jasonzhu0922-sketch

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, and tasks like form filling, table extraction, OCR on scanned documents, and polished report generation each require different approaches and careful validation. ## Core Features & Use Cases - PDF Manipulation: Merge, split, rotate, encrypt, decrypt, watermark, and crop PDFs using pypdf, qpdf, and pdftk. - Content Extraction: Extract text, tables, metadata, and embedded images with pdfplumber, pypdf, and poppler-utils, plus OCR for scanned PDFs via pytesseract. - PDF Generation: Create polished reports with ReportLab/Platypus, including CJK font support, tables of contents, and styled tables, with fallback guidance when WeasyPrint or PyMuPDF are unavailable. - Form Filling: Fill both fillable AcroForm fields and non-fillable forms via text annotations, with structure extraction, bounding-box validation, and visual verification scripts. - Use Case: Given a scanned non-fillable application form, extract its structure, estimate field coordinates from page images, validate bounding boxes, fill it with annotations, and verify the output visually. ## Quick Start Ask the assistant to merge two PDF files into one, extract the tables from a report PDF into a spreadsheet, or fill in a PDF form using the provided field values.

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, pdftotext from poppler-utils is the fastest option.

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

Run extract_form_structure.py to get label, line, and checkbox coordinates, build a fields.json with entry bounding boxes, validate it with check_bounding_boxes.py, then fill it with fill_pdf_form_with_annotations.py. For scanned PDFs, convert pages to images and estimate coordinates visually.

Which Python library should I use to merge or split PDFs?

pypdf handles merging and splitting with PdfReader and PdfWriter by adding pages to a writer and saving. The qpdf command-line tool is an alternative for complex page ranges and batch operations.

Can I extract text from a scanned PDF?

Scanned PDFs have no text layer, so standard parsers return nothing. Convert pages to images with pdf2image and run OCR with pytesseract to produce searchable text.

Why do subscripts and superscripts 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 markup tags inside Paragraph objects instead.

What should I do if WeasyPrint fails when generating a PDF report?

If weasyprint --version fails due to missing Pango or Cairo libraries, fall back immediately to ReportLab or PyMuPDF rather than installing system packages. Verify the final PDF's page count and extractable text afterward.