Main Site ↗

html-to-pdf

by aviz85254GitHub

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.

Unlock Deep Analysis

Use AI to visualize the workflow and generate a realistic output preview for this skill.

Powered by Fastest LLM

Development
pdfconversionhtmlrtlhebrew
Compatible Agents
Claude Code
Claude Code
~/.claude/skills/
Codex CLI
Codex CLI
~/.codex/skills/
Gemini CLI
Gemini CLI
~/.gemini/skills/
O
OpenCode
~/.opencode/skills/
O
OpenClaw
~/.openclaw/skills/
GitHub Copilot
GitHub Copilot
~/.copilot/skills/
Cursor
Cursor
~/.cursor/skills/
W
Windsurf
~/.codeium/windsurf/skills/
C
Cline
~/.cline/skills/
R
Roo Code
~/.roo/skills/
K
Kiro
~/.kiro/skills/
J
Junie
~/.junie/skills/
A
Augment Code
~/.augment/skills/
W
Warp
~/.warp/skills/
G
Goose
~/.config/goose/skills/
SKILL.md

HTML to PDF Conversion

Convert HTML files and web pages to professional PDF documents using Puppeteer.

Quick Start

CLI Usage

node scripts/html-to-pdf.js input.html output.pdf
node scripts/html-to-pdf.js input.html output.pdf A4
node scripts/html-to-pdf.js https://example.com output.pdf A4

Programmatic Usage

const convertHtmlToPdf = require('./scripts/html-to-pdf.js');

// Simple conversion
await convertHtmlToPdf('input.html', 'output.pdf');

// With options
await convertHtmlToPdf('input.html', 'output.pdf', {
  format: 'Letter',
  landscape: true,
  margin: { top: '20mm', bottom: '20mm' }
});

Features

  • āœ… Convert local HTML files
  • āœ… Convert web URLs (http/https)
  • āœ… Customizable page formats (A4, Letter, etc.)
  • āœ… Custom margins and spacing
  • āœ… Landscape/portrait modes
  • āœ… Print backgrounds
  • āœ… Headers and footers
  • āœ… Page ranges
  • āœ… Zoom scaling

Common Options

OptionTypeDefaultNotes
formatstring'A4'A4, Letter, A3, A5, etc.
landscapebooleanfalseLandscape orientation
marginobject10mm all{ top, right, bottom, left }
scalenumber10.1 to 2.0
printBackgroundbooleantrueInclude background colors
displayHeaderFooterbooleanfalseShow header/footer

Advanced Usage

With Headers and Footers

await convertHtmlToPdf('page.html', 'output.pdf', {
  displayHeaderFooter: true,
  headerTemplate: '<div>Page <span class="pageNumber"></span></div>',
  footerTemplate: '<div>Ā© 2024</div>',
  margin: { top: '40px', bottom: '40px' }
});

Specific Page Ranges

await convertHtmlToPdf('document.html', 'pages-1-5.pdf', {
  pageRanges: '1-5'
});

Installation

Requires Node.js and npm:

npm install puppeteer

Reference

For complete API documentation and all available options, see api.md.

Source: https://github.com/aviz85/claude-skills-library#skills-html-to-pdf

Content curated from original sources, copyright belongs to authors

Grade B
-AI Score
Best Practices
Checking...
Try this Skill

User Rating

USER RATING

0UP
0DOWN
Loading files...

WORKS WITH

Claude Code
Claude
Codex CLI
Codex
Gemini CLI
Gemini
O
OpenCode
O
OpenClaw
GitHub Copilot
Copilot
Cursor
Cursor
W
Windsurf
C
Cline
R
Roo
K
Kiro
J
Junie
A
Augment
W
Warp
G
Goose