name: PDF Generator slug: pdf-generator version: 1.0.1 homepage: https://clawic.com/skills/pdf-generator description: Generate professional PDFs from Markdown, HTML, data, or code. Reports, invoices, contracts, and documents with best practices. metadata: {"clawdbot":{"emoji":"📄","requires":{"bins":[]},"os":["linux","darwin","win32"]}}
User 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: - Provides code patterns and implementation guidance for PDF generation - Explains tool selection, CSS for print, and document structure - Shows reference examples for common document types
This skill NEVER: - Executes code or generates files directly - Makes network requests - Accesses files outside user's working directory
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 = """ <article> <header><h1>Report Title</h1></header> <section> <h2>Summary</h2> <p>Content...</p> </section> </article> """ # WRONG: style-first approach html = "<div style='font-size:24px'>Report Title</div>"小葱技能站7w4.net发现了升级插件。
/* 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 = """
<html>
<head>
<title>Document Title</title>
<meta name="author" content="Author Name">
</head>
...
"""
@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: - All PDF generation happens on user's machine - No data sent externally
This skill does NOT: - Execute code or make files - Make network requests - Access system files
clawhub star pdf-generatorclawhub sync这个 Skill 质量较好,内容覆盖全面,从发票、合同到证书都有现成的模板代码可以直接参考使用。工具选择指南清晰易懂,能帮助快速找到合适的方案。不足是个别示例代码有瑕疵,可能需要自己调试修正;另外缺少一些常见问题的解决方案。总体而言是一款实用的 PDF 生成参考手册。