dojo.md
University for AI agents. 92 courses, 4400+ scenarios, any model via OpenRouter. Auto-training loops generate per-model SKILL.md documents. Works with Claude Code, OpenClaw, Cursor, Windsurf. No fine-tuning req...
PDF Generation Skill
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
SkillHub CLI
skillhub install bartok9/pdf-generation打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。
将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。
Purpose: Generate professional PDFs from HTML/CSS without whitespace gaps or layout issues.
When generating PDFs from HTML, page-break-inside: avoid causes orphan whitespace — content that can't fit on the current page gets pushed entirely to the next page, leaving huge gaps.
❌ WRONG:
<div class="page" style="min-height: 297mm;">
<!-- Content -->
</div>
✅ RIGHT:
<body>
<!-- Content flows naturally -->
</body>
Use @page CSS rules instead of fixed page containers:
@page {
size: A4;
margin: 18mm 15mm;
}
Only use break-inside: avoid on elements that:
✅ Protect:
tr)❌ Do NOT Protect:
.small-element {
break-inside: avoid; /* Modern spec */
page-break-inside: avoid; /* Legacy support */
}
h2, h3, h4, .section-header {
break-after: avoid;
page-break-after: avoid;
}
body {
orphans: 3; /* Min lines at bottom of page */
widows: 3; /* Min lines at top of page */
}
table {
/* NO break-inside: avoid */
}
tr {
break-inside: avoid;
page-break-inside: avoid;
}
@page {
size: A4;
margin: 18mm 15mm;
}
body {
font-size: 10pt;
line-height: 1.5;
orphans: 3;
widows: 3;
}
/* Headers stay with content */
h2, h3, h4 {
break-after: avoid;
page-break-after: avoid;
}
/* Small...
这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。
# PDF Generation Skill
**Purpose:** Generate professional PDFs from HTML/CSS without whitespace gaps or layout issues.
## The Problem
When generating PDFs from HTML, `page-break-inside: avoid` causes **orphan whitespace** — content that can't fit on the current page gets pushed entirely to the next page, leaving huge gaps.
## The Solution
### 1. Use Flow-Based Layout (NOT Fixed Page Containers)
**❌ WRONG:**
```html
<div class="page" style="min-height: 297mm;">
<!-- Content -->
</div>
```
**✅ RIGHT:**
```html
<body>
<!-- Content flows naturally -->
</body>
```
Use `@page` CSS rules instead of fixed page containers:
```css
@page {
size: A4;
margin: 18mm 15mm;
}
```
### 2. Protect ONLY Small Elements
Only use `break-inside: avoid` on elements that:
- Are **small** (cards, single rows, short boxes)
- Would look **broken** if split
**✅ Protect:**
- Individual table rows (`tr`)
- Cards (< 100px tall)
- Timeline items
- Step items
- Highlight boxes
**❌ Do NOT Protect:**
- Entire tables
- Large containers
- Entire sections
- Multi-column layouts
- Quote boxes at document end
### 3. Use Modern + Legacy Properties
```css
.small-element {
break-inside: avoid; /* Modern spec */
page-break-inside: avoid; /* Legacy support */
}
```
### 4. Keep Headers With Content
```css
h2, h3, h4, .section-header {
break-after: avoid;
page-break-after: avoid;
}
```
### 5. Prevent Orphan Lines
```css
body {
orphans: 3; /* Min lines at bottom of page */
widows: 3; /* Min lines at top of page */
}
```
### 6. Allow Tables to Break (But Keep Rows Together)
```css
table {
/* NO break-inside: avoid */
}
tr {
break-inside: avoid;
page-break-inside: avoid;
}
```
## Template
```css
@page {
size: A4;
margin: 18mm 15mm;
}
body {
font-size: 10pt;
line-height: 1.5;
orphans: 3;
widows: 3;
}
/* Headers stay with content */
h2, h3, h4 {
break-after: avoid;
page-break-after: avoid;
}
/* Small...University for AI agents. 92 courses, 4400+ scenarios, any model via OpenRouter. Auto-training loops generate per-model SKILL.md documents. Works with Claude Code, OpenClaw, Cursor, Windsurf. No fine-tuning req...
macOS WPS Office workflow helper skill for safer document preparation, conversion, export, and compatibility guidance
A股分析技能
A2A4B2B Skill for OpenClaw