Skip to content
Back to skills

Html To Pdf

ASecurity

Render HTML to a print-quality PDF with correct page breaks, margins, headers/footers, and selectable text.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentspythongo

Works with

  • cli

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill html-to-pdf --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Html To Pdf?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Html To Pdf
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-html-to-pdf/badge)](https://www.skillsdirectory.com/skills/black141312-html-to-pdf)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: html-to-pdf
description: Render HTML to a print-quality PDF with correct page breaks, margins, headers/footers, and selectable text.
category: html
---

# HTML to PDF

Use when you need a paginated, print-fidelity PDF (invoice, report, certificate) from HTML/CSS rather than a screenshot.

1. Pick the engine: headless Chromium (Playwright/Puppeteer `page.pdf()`) for modern CSS, or WeasyPrint for pure-Python paged-media; both keep text selectable.
2. Author a print stylesheet with `@page { size: A4; margin: 18mm }` and `@media print` rules; set a base font size in `pt`/`mm`, not `px`.
3. Control pagination with `break-inside: avoid` on cards/tables, `break-before: page` for new sections, and `orphans`/`widows` for paragraphs.
4. Add running headers/footers and page numbers via `@page` margin boxes (`content: counter(page)`) or the engine's header/footer template option.
5. Ensure `printBackground: true` (Chromium) so background colors/images render; embed fonts so they aren't substituted.
6. Verify output: check pixel-perfect margins, that tables don't split mid-row awkwardly, links remain clickable, and text is selectable (not rasterized).

## Rules
- Use real paged-media CSS, not viewport hacks; set page size and margins in `@page`.
- Wait for fonts and images to fully load before generating (`waitUntil: networkidle`) or content clips.
- Prefer vector/text output over screenshots so the PDF stays small and searchable.
- Test the exact paper size you'll print (A4 vs Letter differ); don't assume the default.
- Avoid fixed-height containers for variable content — they overflow or clip across page breaks.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…