html-to-pdf

Render styled HTML and CSS into print-ready PDF files with WeasyPrint.

6.6k|511|Updated May 6, 2026
One-click install
npx skills add https://github.com/opensquilla/opensquilla --skill html-to-pdf-opensquilla
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: html-to-pdf
Source: https://github.com/opensquilla/opensquilla/tree/main/src/opensquilla/skills/bundled/html-to-pdf
Command: npx skills add https://github.com/opensquilla/opensquilla --skill html-to-pdf-opensquilla

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires weasyprint, and includes scripts (resource) and references (resource) components.

What problem does it solve?

It solves the problem of turning styled HTML (including Jinja-rendered pages) into a shareable, printable PDF without manual exporting.

Core Features & Use Cases

  • HTML + CSS to Paged PDF: Converts HTML and CSS into a PDF using WeasyPrint, including support for CSS Paged Media constructs.
  • Report-Friendly Layout Controls: Enables page size, margins, and page header/footer content (and common page-break rules) for exports like invoices and reports.
  • Document Export Scenarios: Use it for exporting styled reports, invoices, labels, and other HTML-based views to PDF.

Quick Start

Render your HTML file to a PDF by running: python {baseDir}/scripts/render.py --html report.html --out report.pdf.

Frequently Asked Questions about html-to-pdf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert styled HTML to a print-ready PDF for report exporting?

You can convert styled HTML to a print-ready PDF by rendering the HTML and CSS through WeasyPrint, which produces a shareable file for exporting reports and invoices without manual steps.

Does WeasyPrint support CSS Paged Media for setting page size and margins?

WeasyPrint supports CSS Paged Media, allowing you to define page size, margins, and page header or footer content for report-friendly layout controls in the exported PDF.

Can I use Jinja templates to generate HTML for PDF export?

Jinja templates can be used to render the source HTML pages, which are then processed into a printable PDF format suitable for invoices, labels, and other document export scenarios.

What are the limitations of using WeasyPrint for HTML to PDF conversion?

WeasyPrint relies on installed native dependencies and does not execute JavaScript, making it unsuitable for rendering HTML pages that require client-side JavaScript execution to build content.

Do I need local HTML files to export a PDF or can I use URLs?

You do not need strictly local files; the HTML source can exist as local paths, file URLs, or http(s) URLs, provided no JavaScript execution is required to render the content.

What's the best way to add page headers and footers to an exported PDF?

The best way to add headers and footers is by using CSS Paged Media constructs like @page rules, which WeasyPrint processes to inject page header and footer boxes into the final PDF document.