Convert HTML to PDF through headless Chrome, with automatic RTL detection and Hebrew-safe rendering.

CCM score
59 of 100
skills.sh installs
1.3K
GitHub stars
51
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers HTML file, URL, and piped input conversion via scripts/html-to-pdf.js, with format, margin, scale, header, and footer options
  • Includes automatic overflow handling that shrinks small overflow and applies page-break rules to larger content
  • Enforces a single-page check by default, warning when output exceeds the expected --expect-pages count
  • Designed for generating Hebrew or other RTL documents where pixel-accurate CSS rendering and web fonts matter

Install

$ npx -y skills add aviz85/claude-skills-library --skill html-to-pdf -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

HTML to PDF Converter

Pixel-perfect HTML to PDF conversion using Puppeteer (Chrome headless). Provides excellent support for Hebrew, Arabic, and other RTL languages with automatic direction detection.

Why Puppeteer?

  • Pixel-perfect rendering: Uses actual Chrome engine
  • Full CSS3/HTML5 support: Flexbox, Grid, custom fonts, backgrounds
  • JavaScript execution: Renders dynamic content
  • Automatic RTL detection: Detects Hebrew/Arabic and sets direction
  • Web font support: Loads custom fonts properly

Auto-Fit (Built-in, No Flag Needed)

The script automatically handles content overflow:

  • Small overflow (up to ~18%) → auto-shrinks font size to fit the page
  • Large content → flows cleanly across multiple pages with smart page-break rules (no cutting headers, table rows, or images in half)
  • Fits perfectly → does nothing

This runs automatically on every PDF generation. No flags needed.

CRITICAL: Fit Content to Single Page

Backgrounds on html or body cause extra pages! Put backgrounds on a container element instead:

@page { size: A4; margin: 0; }

Details

Repository
github.com/aviz85/claude-skills-library
Categories
Office Files & Slides, Technical Documentation

More from aviz85/claude-skills-library

All 6

Similar to Html To Pdf

More Office Files & Slides