# html-to-pdf > Convert HTML to PDF with pixel-perfect rendering and excellent Hebrew/RTL support. Use when the user asks to 'convert HTML to PDF', 'generate PDF from HTML', 'create PDF from webpage', 'export to PDF', or needs PDF generation with Hebrew text support. - Author: PIKAR AI - Repository: Mrjoel97/pikar-ai - Version: 20260201164003 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/Mrjoel97/pikar-ai - Web: https://mule.run/skillshub/@@Mrjoel97/pikar-ai~html-to-pdf:20260201164003 --- --- name: html-to-pdf description: Convert HTML to PDF with pixel-perfect rendering and excellent Hebrew/RTL support. Use when the user asks to 'convert HTML to PDF', 'generate PDF from HTML', 'create PDF from webpage', 'export to PDF', or needs PDF generation with Hebrew text support. version: "1.0.0" author: aviz85 tags: - pdf - conversion - html - rtl - hebrew allowed-tools: Bash, Read, Write, Glob --- # 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 ## CRITICAL: Fit Content to Single Page **Backgrounds on `html` or `body` cause extra pages!** Put backgrounds on a container element instead: ```css @page { size: A4; margin: 0; } html, body { width: 210mm; height: 297mm; margin: 0; padding: 0; overflow: hidden; /* NO background here! */ } .container { width: 100%; height: 100%; padding: 20mm; box-sizing: border-box; background: linear-gradient(...); /* Background goes HERE */ } ``` **Common causes of extra pages:** 1. **Background on html/body** - always put on `.container` instead 2. Content overflow - use `overflow: hidden` 3. Margins/padding pushing content out **Tips:** - Use `--scale=0.75 --margin=0` if content still overflows - For landscape: use `--landscape` ## Setup (One-time) Before first use, install dependencies: ```bash cd ~/.claude/skills/html-to-pdf && npm install ``` ## Quick Usage ### Convert local HTML file: ```bash node ~/.claude/skills/html-to-pdf/scripts/html-to-pdf.js input.html output.pdf ``` ### Convert URL to PDF: ```bash node ~/.claude/skills/html-to-pdf/scripts/html-to-pdf.js https://example.com page.pdf ``` ### Hebrew document with forced RTL: ```bash node ~/.claude/skills/html-to-pdf/scripts/html-to-pdf.js hebrew.html hebrew.pdf --rtl ``` ### Pipe HTML content: ```bash echo "
זהו מסמך בעברית