Document PDF Skill — Quick Reference
This skill enables PDF creation, extraction, manipulation, and analysis. Claude should apply these patterns when users need to generate invoices, reports, extract data from PDFs, merge documents, or work with PDF forms.
Modern Best Practices (Jan 2026):
- PDF is a release artifact, not the editable source of truth.
- Validate export fidelity (fonts, images, links) and accessibility where required.
- Accessibility: if compliance matters, target a tagged/structured PDF workflow (often PDF/UA-aligned) and validate with tooling.
- EU distribution: EAA (June 2025) typically implies EN 301 549 expectations for customer-facing PDFs.
- Treat PDFs as sensitive: scrub metadata, ensure real redaction, and control distribution.
Core Decision Rules (2026)
- First decide: born-digital PDF (selectable text) vs scanned PDF (images). Scanned PDFs usually require OCR; see
references/pdf-extraction-patterns.md.
- If the user needs accessibility/compliance, prefer generating from a source format that supports structure (DOCX/HTML + proper export) rather than “post-fixing” an untagged PDF.
- For deterministic ops (merge/split/rotate/scrub), prefer
scripts/ helpers over re-implementing ad hoc.
- Never treat black rectangles or overlays as redaction; use real redaction and verify by copy/paste + search.
Quick Reference
| Task |
Tool/Library |
Language |
When to Use |
| Create PDF |
pdfkit |
Node.js |
Reports, invoices, certificates |
| Create PDF |
ReportLab |
Python |
Complex layouts, tables |
| Create PDF |
FPDF2 |
Python |
Simple PDFs with Unicode support |
| Create PDF |
Borb |
Python |
Interactive elements, pure Python |
| Edit PDF |
pdf-lib |
Node.js |
Modify existing PDFs, add pages |
| Extract text |
pdfplumber |
Python |
OCR-free text extraction |
| OCR scanned PDF |
PyMuPDF + Tesseract |
Python |
Scanned PDFs (no selectable text) |
| Extract tables |
Camelot |
Python |
Tables with borders (Lattice mode) |
| Extract tables |
Camelot/Tabula |
Python |
Tables without borders (Stream mode) |
| Parse/merge/split/rotate |
pypdf |
Python |
Deterministic PDF manipulation |
| Fill forms |
pdf-lib |
Node.js |
Form automation |
| HTML to PDF |
Puppeteer/Playwright |
Node.js |
High-fidelity web page rendering |
| HTML to PDF |
WeasyPrint |
Python |
CSS3-based, no browser needed |
When to Use This Skill
Claude should invoke this skill when a user requests:
- Generate PDFs from data (invoices, reports, certificates)
- Extract text or tables from existing PDFs
- Merge multiple PDFs into one document
- Split PDFs into separate files
- Fill PDF forms programmatically
- Add watermarks, headers, footers
- Convert HTML/web pages to PDF
Default Workflow
- Create: pick
pdfkit (Node) or ReportLab (Python) and start from assets/invoice-template.md or assets/report-template.md; for advanced layouts use references/pdf-generation-patterns.md.
- Extract: use
references/pdf-extraction-patterns.md (text/tables/images/metadata + OCR fallback).
- Ship: run
assets/pdf-release-checklist.md (fidelity, links, accessibility baseline, privacy).
Scripts (Deterministic Operations)
Scripts are optional helpers; they assume Python 3 plus the listed dependencies in each file.
- Merge:
python3 scripts/merge_pdfs.py merged.pdf a.pdf b.pdf
- Split:
python3 scripts/split_pdf.py in.pdf out_dir --each-page
- Rotate:
python3 scripts/rotate_pdf.py in.pdf out.pdf --degrees 90
- Scrub metadata:
python3 scripts/scrub_metadata.py in.pdf out.pdf
PDF Structure Patterns
Invoice Template
INVOICE STRUCTURE
├── Header (logo, company info, invoice #)
├── Bill To / Ship To blocks
├── Line items table
│ ├── Description | Qty | Unit Price | Total
│ └── Subtotal, Tax, Total
├── Payment terms
└── Footer (contact, thank you)
Report Template
REPORT PDF STRUCTURE
├── Cover page (title, author, date)
├── Table of contents
├── Body sections with page numbers
├── Charts/images with captions
├── Appendices
└── Running header/footer
Decision Tree
PDF Task: [What do you need?]
├─ Create new PDF?
│ ├─ Simple text/tables → pdfkit (Node) or ReportLab (Python)
│ ├─ Complex layouts → ReportLab with Platypus
│ └─ From HTML → Puppeteer or wkhtmltopdf
│
├─ Extract from PDF?
│ ├─ Text only → pdfplumber (Python)
│ ├─ Tables → pdfplumber or camelot (Python)
│ └─ Images → PyMuPDF/fitz (Python)
│
├─ Modify existing PDF?
│ ├─ Add text/images → pdf-lib (Node)
│ ├─ Merge/split → pypdf or pdf-lib
│ └─ Fill forms → pdf-lib
│
└─ Batch processing?
└─ pypdf + pdfplumber pipeline
Do / Avoid (Jan 2026)
Do
- Keep a versioned source document (doc/slide/design file) alongside the PDF.
- Verify links and reading order for long documents.
- Use real redaction and test by copy/paste.
Avoid
- Editing PDFs as the primary workflow when a source doc exists.
- Shipping PDFs with broken links or illegible charts.
- Including customer PII or secrets in PDFs without explicit approval.
What Good Looks Like
- Fidelity: export is reproducible from a versioned source file (doc/slide/design) and looks identical across viewers.
- Accessibility: tags/reading order are correct; links work; scanned docs are OCRed when appropriate.
- Release hygiene: file naming includes version/date; metadata is clean; no “PDF as source of truth”.
- Security: redaction is verified (copy/paste test) and sensitive data is minimized.
- QA: release checklist completed using
assets/pdf-release-checklist.md.
Optional: AI / Automation
Use only when explicitly requested and policy-compliant.
- Generate a release checklist run; humans verify the final PDF manually.
Navigation
Resources
- references/pdf-generation-patterns.md — Complex layouts, multi-page docs
- references/pdf-extraction-patterns.md — Text, table, image extraction
- data/sources.json — Library documentation links
Templates
- assets/invoice-template.md — Invoice PDF generation
- assets/report-template.md — Multi-page report structure
- assets/pdf-release-checklist.md — Links, accessibility, export fidelity
Related Skills
1---2name: document-pdf3description: Extract text/tables from PDFs, create formatted PDFs, merge/split/rotate, handle forms and metadata. Supports pdf-lib/pdfkit (Node.js) and pypdf/pdfplumber/ReportLab (Python).4---5
6# Document PDF Skill — Quick Reference
7
8This skill enables PDF creation, extraction, manipulation, and analysis. Claude should apply these patterns when users need to generate invoices, reports, extract data from PDFs, merge documents, or work with PDF forms.
9
10**Modern Best Practices (Jan 2026)**:
11- PDF is a release artifact, not the editable source of truth.
12- Validate export fidelity (fonts, images, links) and accessibility where required.
13- Accessibility: if compliance matters, target a tagged/structured PDF workflow (often PDF/UA-aligned) and validate with tooling.
14- EU distribution: EAA (June 2025) typically implies EN 301 549 expectations for customer-facing PDFs.
15- Treat PDFs as sensitive: scrub metadata, ensure real redaction, and control distribution.
16
17## Core Decision Rules (2026)
18
19- First decide: born-digital PDF (selectable text) vs scanned PDF (images). Scanned PDFs usually require OCR; see `references/pdf-extraction-patterns.md`.
20- If the user needs accessibility/compliance, prefer generating from a source format that supports structure (DOCX/HTML + proper export) rather than “post-fixing” an untagged PDF.
21- For deterministic ops (merge/split/rotate/scrub), prefer `scripts/` helpers over re-implementing ad hoc.
22- Never treat black rectangles or overlays as redaction; use real redaction and verify by copy/paste + search.
23
24---
25
26## Quick Reference
27
28| Task | Tool/Library | Language | When to Use |
29|------|--------------|----------|-------------|
30| Create PDF | pdfkit | Node.js | Reports, invoices, certificates |
31| Create PDF | ReportLab | Python | Complex layouts, tables |
32| Create PDF | FPDF2 | Python | Simple PDFs with Unicode support |
33| Create PDF | Borb | Python | Interactive elements, pure Python |
34| Edit PDF | pdf-lib | Node.js | Modify existing PDFs, add pages |
35| Extract text | pdfplumber | Python | OCR-free text extraction |
36| OCR scanned PDF | PyMuPDF + Tesseract | Python | Scanned PDFs (no selectable text) |
37| Extract tables | Camelot | Python | Tables with borders (Lattice mode) |
38| Extract tables | Camelot/Tabula | Python | Tables without borders (Stream mode) |
39| Parse/merge/split/rotate | pypdf | Python | Deterministic PDF manipulation |
40| Fill forms | pdf-lib | Node.js | Form automation |
41| HTML to PDF | Puppeteer/Playwright | Node.js | High-fidelity web page rendering |
42| HTML to PDF | WeasyPrint | Python | CSS3-based, no browser needed |
43
44## When to Use This Skill
45
46Claude should invoke this skill when a user requests:
47
48- Generate PDFs from data (invoices, reports, certificates)
49- Extract text or tables from existing PDFs
50- Merge multiple PDFs into one document
51- Split PDFs into separate files
52- Fill PDF forms programmatically
53- Add watermarks, headers, footers
54- Convert HTML/web pages to PDF
55
56---
57
58## Default Workflow
59
60- Create: pick `pdfkit` (Node) or `ReportLab` (Python) and start from `assets/invoice-template.md` or `assets/report-template.md`; for advanced layouts use `references/pdf-generation-patterns.md`.
61- Extract: use `references/pdf-extraction-patterns.md` (text/tables/images/metadata + OCR fallback).
62- Ship: run `assets/pdf-release-checklist.md` (fidelity, links, accessibility baseline, privacy).
63
64## Scripts (Deterministic Operations)
65
66Scripts are optional helpers; they assume Python 3 plus the listed dependencies in each file.
67
68- Merge: `python3 scripts/merge_pdfs.py merged.pdf a.pdf b.pdf`
69- Split: `python3 scripts/split_pdf.py in.pdf out_dir --each-page`
70- Rotate: `python3 scripts/rotate_pdf.py in.pdf out.pdf --degrees 90`
71- Scrub metadata: `python3 scripts/scrub_metadata.py in.pdf out.pdf`
72
73## PDF Structure Patterns
74
75### Invoice Template
76
77```text
78INVOICE STRUCTURE
79├── Header (logo, company info, invoice #)
80├── Bill To / Ship To blocks
81├── Line items table
82│ ├── Description | Qty | Unit Price | Total
83│ └── Subtotal, Tax, Total
84├── Payment terms
85└── Footer (contact, thank you)
86```
87
88### Report Template
89
90```text
91REPORT PDF STRUCTURE
92├── Cover page (title, author, date)
93├── Table of contents
94├── Body sections with page numbers
95├── Charts/images with captions
96├── Appendices
97└── Running header/footer
98```
99
100---
101
102## Decision Tree
103
104```text
105PDF Task: [What do you need?]
106 ├─ Create new PDF?
107 │ ├─ Simple text/tables → pdfkit (Node) or ReportLab (Python)
108 │ ├─ Complex layouts → ReportLab with Platypus
109 │ └─ From HTML → Puppeteer or wkhtmltopdf
110 │
111 ├─ Extract from PDF?
112 │ ├─ Text only → pdfplumber (Python)
113 │ ├─ Tables → pdfplumber or camelot (Python)
114 │ └─ Images → PyMuPDF/fitz (Python)
115 │
116 ├─ Modify existing PDF?
117 │ ├─ Add text/images → pdf-lib (Node)
118 │ ├─ Merge/split → pypdf or pdf-lib
119 │ └─ Fill forms → pdf-lib
120 │
121 └─ Batch processing?
122 └─ pypdf + pdfplumber pipeline
123```
124
125---
126
127## Do / Avoid (Jan 2026)
128
129### Do
130
131- Keep a versioned source document (doc/slide/design file) alongside the PDF.
132- Verify links and reading order for long documents.
133- Use real redaction and test by copy/paste.
134
135### Avoid
136
137- Editing PDFs as the primary workflow when a source doc exists.
138- Shipping PDFs with broken links or illegible charts.
139- Including customer PII or secrets in PDFs without explicit approval.
140
141## What Good Looks Like
142
143- Fidelity: export is reproducible from a versioned source file (doc/slide/design) and looks identical across viewers.
144- Accessibility: tags/reading order are correct; links work; scanned docs are OCRed when appropriate.
145- Release hygiene: file naming includes version/date; metadata is clean; no “PDF as source of truth”.
146- Security: redaction is verified (copy/paste test) and sensitive data is minimized.
147- QA: release checklist completed using `assets/pdf-release-checklist.md`.
148
149## Optional: AI / Automation
150
151Use only when explicitly requested and policy-compliant.
152
153- Generate a release checklist run; humans verify the final PDF manually.
154
155## Navigation
156
157**Resources**
158- [references/pdf-generation-patterns.md](references/pdf-generation-patterns.md) — Complex layouts, multi-page docs
159- [references/pdf-extraction-patterns.md](references/pdf-extraction-patterns.md) — Text, table, image extraction
160- [data/sources.json](data/sources.json) — Library documentation links
161
162**Templates**
163- [assets/invoice-template.md](assets/invoice-template.md) — Invoice PDF generation
164- [assets/report-template.md](assets/report-template.md) — Multi-page report structure
165- [assets/pdf-release-checklist.md](assets/pdf-release-checklist.md) — Links, accessibility, export fidelity
166
167**Related Skills**
168- [../document-docx/SKILL.md](../document-docx/SKILL.md) — Word document generation
169- [../document-xlsx/SKILL.md](../document-xlsx/SKILL.md) — Excel/spreadsheet workflows
170- [../document-pptx/SKILL.md](../document-pptx/SKILL.md) — PowerPoint presentations