---
name: "weasyprint-html-print-pdf"
description: "Render modern HTML5 and CSS3 documents directly into print-perfect PDF files."
metadata:
  author: "Kozea"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "convert html to pdf weasyprint"
  - "css paged media page break"
  - "add headers and footers weasyprint"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# WeasyPrint Modern HTML to Print PDF

Converts web pages and semantic HTML templates into high-quality PDFs with CSS Paged Media specifications: @page margins, page-break rules, headers, and footers.

## When to Invoke
Invoke this skill whenever you need to:
- convert html to pdf weasyprint
- css paged media page break
- add headers and footers weasyprint

## Execution SOP & Rules
1. Use @page { size: A4; margin: 20mm; @bottom-right { content: counter(page); } } for paged layout.
2. Apply break-inside: avoid on cards, table rows, and signatures to prevent split layouts.
3. Load external fonts via standard @font-face declarations inside CSS stylesheets.
4. Generate PDF output using HTML(string=html_content).write_pdf(target_path).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
