agentleFS
phanghonghaophanghonghao/THU-Awesome-Skills/skills/html2pdf/SKILL.md

html2pdf

Skill8 starsChanged 3 months agoMITView on GitHub

Convert HTML, especially slide-style HTML presentations, into paginated PDF using Chrome or Edge headless printing. Use when the user mentions `html2pdf`, wants to export HTML to PDF, or needs each slide/page in a presentation HTML to become a separate PDF page instead of one long page.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the HTML looks like a presentation, let the script auto-inject print pagination CSS.

    line 37
  2. Distinctive:

    If available, verify the resulting PDF page count and report the output path.

    line 39
  3. Very specific:

    If the HTML already has correct @media print pagination rules, the script can still print it directly.

    line 63
  4. Distinctive:

    Prefer reporting the generated PDF path and page count instead of dumping command output.

    line 64

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

html2pdf

Convert local HTML files to PDF with browser-grade rendering.

This skill is designed for two cases:

  • ordinary HTML pages that should print to PDF as-is
  • presentation-style HTML with fixed-size .slide pages that need to become multi-page PDF output

Run

From this skill directory, run:

python html2pdf.py <input.html> [output.pdf]

What It Does

For presentation HTML, the script can:

  • detect slide-style layouts such as .presentation and .slide
  • inject print CSS into a temporary copy
  • make all slides visible during print
  • force each slide to become one PDF page
  • hide navigation bars during export

For ordinary HTML, it prints the page directly without altering the source file.

Workflow

  1. Confirm the input HTML exists.
  2. Run html2pdf.py.
  3. If the HTML looks like a presentation, let the script auto-inject print pagination CSS.
  4. Export with Chrome or Edge headless.
  5. If available, verify the resulting PDF page count and report the output path.

Examples

# Default output: same basename as input
python html2pdf.py "slides.html"

# Explicit output path
python html2pdf.py "slides.html" "slides_10pages.pdf"

Dependencies

Require one of:

  • Google Chrome
  • Microsoft Edge

Optional:

  • PyPDF2 for PDF page-count verification

Notes

  • The script does not overwrite the source HTML. It writes a temporary print-ready copy when needed.
  • If the HTML already has correct @media print pagination rules, the script can still print it directly.
  • Prefer reporting the generated PDF path and page count instead of dumping command output.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.