# html-to-pdf

Renders HTML files, URLs, and piped markup into PDF documents using headless Chrome with built-in right-to-left language handling.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1200 installs · ★ 50
- Author: aviz85
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/aviz85/claude-skills-library/tree/HEAD/skills/html-to-pdf/SKILL.md
- Updated: 2026-07-08
- HTML: https://affpapa.org/en/nevibecode/skills/html-to-pdf

## What it does

This skill runs a Node.js script via Puppeteer to render HTML assets as PDFs. Because Chromium handles the rendering, flexbox, CSS grid layouts, web fonts, and client-side JavaScript appear exactly as intended. The tool identifies Hebrew or Arabic text on its own, though passing `--rtl` forces the direction when needed.

An auto-fit mechanism resolves page overflow issues. When content spills by up to ~18%, font sizes shrink automatically to preserve a single-page layout. Larger materials flow cleanly across sheets without splitting table rows or headers. For page count checks, the script invokes `pdfinfo` from `poppler-utils`. The check skips silently if that package is absent.

Applying backgrounds to `html` or `body` elements produces unintended extra pages. Place backgrounds inside an inner wrapper instead. You must run `npm install` inside the skill directory before executing your first conversion.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add aviz85/claude-skills-library --skill html-to-pdf -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/html-to-pdf/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/html-to-pdf/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add aviz85/claude-skills-library --skill html-to-pdf -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/html-to-pdf/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add aviz85/claude-skills-library --skill html-to-pdf -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/html-to-pdf/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install aviz85/claude-skills-library html-to-pdf
```

2. **Manually: put the files in place**
- File: `.github/skills/html-to-pdf/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add aviz85/claude-skills-library --skill html-to-pdf -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/aviz85/claude-skills-library --path skills/html-to-pdf
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/html-to-pdf/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add aviz85/claude-skills-library --skill html-to-pdf -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/aviz85/claude-skills-library/tree/HEAD/skills/html-to-pdf/SKILL.md

## When to use it
- render local HTML templates directly into PDF files
- export web URLs into print-ready A4 or Letter documents
- format Hebrew or Arabic documents with correct RTL alignment
- pipe raw HTML code from terminal streams directly into PDFs

## Example prompts
- Convert my local invoice.html into a PDF file using Letter format
- Download https://example.com and save it as a landscape PDF
- Render hebrew-doc.html into a PDF file with forced RTL layout

## Similar
- [grill-with-docs](https://affpapa.org/en/nevibecode/skills/grill-with-docs.md) — skill · 1219756 installs
- [skill-creator](https://affpapa.org/en/nevibecode/skills/skill-creator.md) — skill · 414180 installs
- [setup-matt-pocock-skills](https://affpapa.org/en/nevibecode/skills/setup-matt-pocock-skills.md) — skill · 1052851 installs
- [handoff](https://affpapa.org/en/nevibecode/skills/handoff.md) — skill · 1038491 installs
- [triage](https://affpapa.org/en/nevibecode/skills/triage.md) — skill · 990453 installs
- [domain-modeling](https://affpapa.org/en/nevibecode/skills/domain-modeling.md) — skill · 876391 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
