pdf

Extract, create, merge, split, and fill PDF documents using Python libraries.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pypdf, pdfplumber, reportlab, pypdfium2, pdf2image, Pillow, and includes scripts (resource) and references (resource) components.

What problem does it solve? Working with PDF documents programmatically is error-prone: text extraction loses layout, tables come out garbled, forms are hard to fill, and generated PDFs often have broken fonts, missing metadata, or poor typography. This Skill provides a complete, battle-tested workflow for every common PDF operation. ## Core Features & Use Cases - PDF Generation: Create professional PDFs with reportlab, including cover pages, tables of contents, styled tables, charts, and correct Chinese/English font handling. - Extraction & Manipulation: Extract text and tables with pdfplumber, merge/split/rotate/crop pages with pypdf, and render pages to images with pypdfium2. - Form Filling: Fill both fillable PDF forms (via field extraction scripts) and non-fillable forms (via visual bounding-box analysis and text annotations). - Use Case: Generate a 10-page Chinese financial report PDF with a cover page, TOC, styled tables, and charts, then automatically stamp it with proper document metadata. ## Quick Start Use the pdf skill to create a 3-page PDF report summarizing the attached data, with a cover page and a formatted results table.

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 preservation and detect tables via cell boundaries, or use pypdf's extract_text() for simple text. pdfplumber returns tables as row lists that convert directly to CSV or pandas DataFrames.

How do I fill out a PDF form programmatically?

First run check_fillable_fields.py to detect fillable fields. If present, extract field info to JSON and fill values with fill_fillable_fields.py. For non-fillable forms, convert pages to images, determine bounding boxes visually, and add text annotations.

How do I merge or split PDF files with Python?

Use pypdf's PdfWriter and PdfReader: add pages from multiple readers to one writer to merge, or write each page to a separate writer to split. The qpdf command-line tool also handles complex page-range extraction.

Why do Chinese characters show as blank boxes in reportlab PDFs?

English fonts like Times New Roman cannot render CJK characters. Register Chinese fonts such as SimHei or Microsoft YaHei with TTFont, and wrap mixed-language segments in inline font tags inside Paragraph objects.

Can I extract text from a scanned PDF?

Standard parsers cannot read scanned image PDFs. Convert pages to images with pdf2image or pypdfium2, then run OCR with pytesseract to obtain machine-readable text.