Report Title
Summary
Content...
by @ivangdavila
Generate professional PDFs from Markdown, HTML, data, or code. Reports, invoices, contracts, and documents with best practices.
clawhub install pdf-generatorUser needs to create, generate, or export PDF documents. Agent handles document generation from multiple sources (Markdown, HTML, JSON, templates), formatting, styling, and batch processing.
This skill ONLY:
This skill NEVER:
All code examples are reference patterns for the user to implement.
| Topic | File |
|-------|------|
| Tool selection | tools.md |
| Document types | templates.md |
| Advanced operations | advanced.md |
| Source | Best Tool | Why | |--------|-----------|-----| | Markdown | pandoc | Native support, TOC, templates | | HTML/CSS | weasyprint | Best CSS support, no LaTeX | | Data/JSON | reportlab | Programmatic, precise control | | Simple text | fpdf2 | Lightweight, fast |
Default recommendation: weasyprint for most HTML-based documents.
# CORRECT: semantic structure
html = """
Report Title
Summary
Content...
"""WRONG: style-first approach
html = "Report Title"
/* Force page break before */
.new-page { page-break-before: always; }/* Keep together */
.keep-together { page-break-inside: avoid; }
/* Headers never orphaned */
h2, h3 { page-break-after: avoid; }
# Example pattern for weasyprint
html = """
Document Title
...
"""
@media print {
body {
font-family: 'Georgia', serif;
font-size: 11pt;
line-height: 1.5;
}
@page {
size: A4;
margin: 2cm;
}
.no-print { display: none; }
}
After generating any PDF: 1. Check file size (0 bytes = failed) 2. Open and verify page count 3. Verify fonts render correctly
| Trap | Consequence | Fix |
|------|-------------|-----|
| Missing fonts | Fallback to defaults | Use web-safe fonts |
| Absolute image paths | Images missing | Use relative paths |
| No page size | Unpredictable layout | Set @page { size: A4; } |
| Large images | Huge files | Compress before use |
This is a reference skill. It provides patterns and guidance only.
Data that stays local:
This skill does NOT:
clawhub star pdf-generatorclawhub syncUser needs to create, generate, or export PDF documents. Agent handles document generation from multiple sources (Markdown, HTML, JSON, templates), formatting, styling, and batch processing.