html-to-pdf

Convert an HTML file to a PDF using headless Chrome (Puppeteer) — the same approach atypica uses for its AI-generated research reports. Use this skill whenever the user wants to export an HTML file, report, or webpage snapshot to PDF. Trigger on phrases like "convert to PDF", "export as PDF", "save report as PDF", "html to pdf", "generate PDF from HTML", or when a user hands you an .html file and asks for a downloadable document. Even if the user just says "make a PDF of this", use this skill if the source is HTML.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "html-to-pdf" with this command: npx skills add owenrao/html2pdf

Overview

This skill converts an HTML file to PDF using Puppeteer (headless Chromium), exactly how atypica exports its AI research reports. Two modes are supported:

ModeWhen to use
Single-page (default)Design/report pages meant to look like one tall poster — no page breaks. Full-width at 1440 px.
PaginatedDocuments meant to be printed or read page-by-page (A4, Letter, etc.).

Quickstart (3 steps)

# 1. Copy the bundled scripts to a working directory
cp <skill-dir>/scripts/html-to-pdf.js ./
cp <skill-dir>/scripts/package.json ./

# 2. Install the only dependency (downloads Chromium automatically, ~170 MB, one-time)
npm install

# 3. Run
node html-to-pdf.js report.html report.pdf

<skill-dir> is the directory that contains this SKILL.md file.

Note: npm install puppeteer (~170 MB) downloads a pinned Chromium binary. This is the only install step — no system Chrome, no wkhtmltopdf, no separate server needed. If the environment already has Puppeteer installed, skip step 2.


Command reference

node html-to-pdf.js <input.html> <output.pdf> [options]

Options:
  --paginated         A4-paginated mode (respects @media print, page-breaks)
  --format <fmt>      Page format: A4 (default), A3, Letter, Legal
  --width <px>        Viewport width for single-page mode (default: 1440)
  --wait <ms>         Extra milliseconds to wait after page load (for JS-rendered content)
  --header-footer     Add page-number footer in paginated mode

Examples

# Single-page full-height (atypica report style)
node html-to-pdf.js report.html report.pdf

# A4 paginated document
node html-to-pdf.js document.html document.pdf --paginated

# A4 with page numbers
node html-to-pdf.js document.html document.pdf --paginated --header-footer

# Narrower single-page layout
node html-to-pdf.js report.html report.pdf --width 1280

# Wait 2 s for JavaScript-rendered charts
node html-to-pdf.js dashboard.html dashboard.pdf --wait 2000

How it works (mirrors atypica's browser service)

  1. Launches headless Chromium via Puppeteer with sandbox disabled and CJK font hints enabled.
  2. Loads the HTML from a file:// URL so relative assets (images, local CSS) resolve correctly.
  3. Injects system-font CSS to ensure Chinese/Japanese/Korean characters render on any OS.
  4. Single-page mode: measures document.body.scrollHeight, sets viewport to that height, and generates a single-page PDF at that exact size — no clipping, no page breaks.
  5. Paginated mode: injects @media print CSS for clean page-breaks, then generates a standard-format paginated PDF.
  6. Writes the PDF buffer to the output path.

Handling common issues

ProblemFix
Chromium not found after npm install puppeteerRun npx puppeteer browsers install chrome
Missing system fonts / boxes instead of CJK charsInject works for most cases; for guaranteed rendering install fonts-noto-cjk (Linux) or ensure macOS system fonts are accessible
JavaScript-rendered content missingAdd --wait 2000 (or more) to let JS execute after load
Images not loadingMake sure image src paths are relative to the HTML file location
PDF cut off at bottomThe script auto-measures height; if content loads lazily add --wait
--no-sandbox error in strict containerPuppeteer requires --no-sandbox in Docker/CI; this flag is already set

Dependency notes

  • Node.js ≥ 18 required (≥ 20 recommended)
  • puppeteer is the only npm dependency — it self-contains Chromium
  • No global Chrome installation needed
  • Works on macOS, Linux, and Windows (WSL)
  • In CI/Docker, add --disable-dev-shm-usage (already included in the script)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Research

LobsterBio - Use

Analyze biological data using Lobster AI — single-cell RNA-seq, bulk RNA-seq, literature mining, dataset discovery, quality control, and visualization. USE THIS SKILL WHEN: - Analyzing single-cell or bulk RNA-seq data - Searching PubMed/GEO for papers or datasets - Running quality control on biological data - Clustering cells, finding markers, differential expression - Creating publication-quality visualizations - Working with H5AD, CSV, 10X, GEO/SRA accessions TRIGGER PHRASES: "analyze cells", "search PubMed", "download GEO", "run QC", "cluster", "find markers", "differential expression", "UMAP", "volcano plot", "single-cell", "RNA-seq", "bioinformatics" ASSUMES: Lobster is installed and configured. For setup issues, tell user to run `lobster config-test` and fix any errors before proceeding.

Registry SourceRecently Updated
1.3K0Profile unavailable
Research

Angel of Indian Krump

Krump Knowledge and Personality Identity — embodies Asura's legacy, lineage, and technical expertise

Registry SourceRecently Updated
1.1K0Profile unavailable
Research

Lead Generation

Lead Generation — Find high-intent buyers in live Twitter, Instagram, and Reddit conversations. Auto-researches your product, generates targeted search queries, and discovers people actively looking for solutions you offer. Social selling and prospecting powered by 1.5B+ indexed posts via Xpoz MCP.

Registry SourceRecently Updated
3.6K12Profile unavailable
Research

Solana Sniper Bot

Autonomous Solana token sniper and trading bot. Monitors new token launches on Raydium/Jupiter, evaluates rugpull risk with LLM analysis, auto-buys promising launches, and manages exit strategies. Use when user wants to snipe Solana token launches, trade memecoins, monitor new Solana pairs, or build a Solana trading bot. Supports cron-based monitoring, take-profit/stop-loss, and portfolio tracking.

Registry SourceRecently Updated
1.3K0Profile unavailable