Search

PythonReactSEOPDF
OpenClaw

Pdf Generation

PDF Generation Skill

bartok90 source installs☆ 0 Repository stars

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

SkillHub CLI

skillhub install bartok9/pdf-generation

Inspect the source and compatibility requirements, then follow its installation steps.

Give your agent the source link and ask it to inspect instructions and dependencies before explaining the installation steps.

View source ↗Guides

Skill instructions

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:

<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;
}
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
.small-element {
    break-inside: avoid;        /* Modern spec */
    page-break-inside: avoid;   /* Legacy support */
}
4. Keep Headers With Content
h2, h3, h4, .section-header {
    break-after: avoid;
    page-break-after: avoid;
}
5. Prevent Orphan Lines
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)
table {
    /* NO break-inside: avoid */
}

tr {
    break-inside: avoid;
    page-break-inside: avoid;
}

Template

@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...

Source information

Source
github
Repository
openclaw/skills
Path
skills/bartok9/pdf-generation
Version
—
Commit
65971d728ca990c11e56b419f96473572f051a82
Classification source
rules
Status
active
Visibility
public

These signals come from indexed source analysis and may lag behind changes. Check the current source files.

Extracted content

SKILL.md
# 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...

Related skills

OpenClaw

dojo.md

edholofy

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...

OpenClaw

wps-macos-helper

lethehades

macOS WPS Office workflow helper skill for safer document preparation, conversion, export, and compatibility guidance