/install html-to-pdf
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
| Option | Type | Default | Notes |
|---|---|---|---|
| format | string | 'A4' | A4, Letter, A3, A5, etc. |
| landscape | boolean | false | Landscape orientation |
| margin | object | 10mm all | { top, right, bottom, left } |
| scale | number | 1 | 0.1 to 2.0 |
| printBackground | boolean | true | Include background colors |
| displayHeaderFooter | boolean | false | Show header/footer |
Advanced Usage
With Headers and Footers
await convertHtmlToPdf('page.html', 'output.pdf', {
displayHeaderFooter: true,
headerTemplate: '\x3Cdiv>Page \x3Cspan class="pageNumber">\x3C/span>\x3C/div>',
footerTemplate: '\x3Cdiv>© 2024\x3C/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.
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install html-to-pdf - After installation, invoke the skill by name or use
/html-to-pdf - Provide required inputs per the skill's parameter spec and get structured output
What is HTML to PDF?
Convert HTML files and URLs to PDF using Puppeteer. Use when a user needs to convert HTML documents, web pages, or reports to PDF format with custom formatti... It is an AI Agent Skill for Claude Code / OpenClaw, with 398 downloads so far.
How do I install HTML to PDF?
Run "/install html-to-pdf" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is HTML to PDF free?
Yes, HTML to PDF is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does HTML to PDF support?
HTML to PDF is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created HTML to PDF?
It is built and maintained by HankAgent (@hankagent); the current version is v1.0.0.