pdf-generation
Installation
SKILL.md
PDF Generation Skill
Purpose
PDF generation is essential for invoices, reports, certificates, contracts, and data exports. This skill covers the full spectrum: from browser-based HTML-to-PDF rendering (Puppeteer/Playwright) to programmatic PDF construction (pdfkit, react-pdf) to client-side generation (jsPDF).
When to Use What
| Library | Best For | Runtime | Styling | Size Impact |
|---|---|---|---|---|
| Puppeteer / Playwright | Complex HTML layouts, pixel-perfect CSS | Server (needs Chromium) | Full CSS, Tailwind, Flexbox, Grid | ~400MB (Chromium) |
| @react-pdf/renderer | React developers, component-based layouts | Server or client | React-PDF subset (Flexbox, no CSS Grid) | ~2MB |
| pdfkit | Programmatic PDF, precise control | Server (Node.js) | Manual positioning, no CSS | ~5MB |
| jsPDF | Client-side generation, simple documents | Browser | Manual positioning | ~300KB |
Playwright page.pdf() |
Already using Playwright, need PDF export | Server | Full CSS | ~400MB |