html-to-pdf
Overview
This skill converts an HTML file to PDF using Puppeteer (headless Chromium), exactly how atypica exports its AI research reports. Two modes are supported:
| Mode | When to use |
|---|---|
| Single-page (default) | Design/report pages meant to look like one tall poster — no page breaks. Full-width at 1440 px. |
| Paginated | Documents meant to be printed or read page-by-page (A4, Letter, etc.). |
Quickstart (3 steps)
# 1. Copy the bundled scripts to a working directory
cp <skill-dir>/scripts/html-to-pdf.js ./
cp <skill-dir>/scripts/package.json ./
# 2. Install the only dependency (downloads Chromium automatically, ~170 MB, one-time)
npm install
# 3. Run
node html-to-pdf.js report.html report.pdf
<skill-dir> is the directory that contains this SKILL.md file.
Note:
npm install puppeteer(~170 MB) downloads a pinned Chromium binary. This is the only install step — no system Chrome, no wkhtmltopdf, no separate server needed. If the environment already has Puppeteer installed, skip step 2.
Command reference
node html-to-pdf.js <input.html> <output.pdf> [options]
Options:
--paginated A4-paginated mode (respects @media print, page-breaks)
--format <fmt> Page format: A4 (default), A3, Letter, Legal
--width <px> Viewport width for single-page mode (default: 1440)
--wait <ms> Extra milliseconds to wait after page load (for JS-rendered content)
--header-footer Add page-number footer in paginated mode
Examples
# Single-page full-height (atypica report style)
node html-to-pdf.js report.html report.pdf
# A4 paginated document
node html-to-pdf.js document.html document.pdf --paginated
# A4 with page numbers
node html-to-pdf.js document.html document.pdf --paginated --header-footer
# Narrower single-page layout
node html-to-pdf.js report.html report.pdf --width 1280
# Wait 2 s for JavaScript-rendered charts
node html-to-pdf.js dashboard.html dashboard.pdf --wait 2000
How it works (mirrors atypica's browser service)
- Launches headless Chromium via Puppeteer with sandbox disabled and CJK font hints enabled.
- Loads the HTML from a
file://URL so relative assets (images, local CSS) resolve correctly. - Injects system-font CSS to ensure Chinese/Japanese/Korean characters render on any OS.
- Single-page mode: measures
document.body.scrollHeight, sets viewport to that height, and generates a single-page PDF at that exact size — no clipping, no page breaks. - Paginated mode: injects
@media printCSS for clean page-breaks, then generates a standard-format paginated PDF. - Writes the PDF buffer to the output path.
Handling common issues
| Problem | Fix |
|---|---|
Chromium not found after npm install puppeteer |
Run npx puppeteer browsers install chrome |
| Missing system fonts / boxes instead of CJK chars | Inject works for most cases; for guaranteed rendering install fonts-noto-cjk (Linux) or ensure macOS system fonts are accessible |
| JavaScript-rendered content missing | Add --wait 2000 (or more) to let JS execute after load |
| Images not loading | Make sure image src paths are relative to the HTML file location |
| PDF cut off at bottom | The script auto-measures height; if content loads lazily add --wait |
--no-sandbox error in strict container |
Puppeteer requires --no-sandbox in Docker/CI; this flag is already set |
Dependency notes
- Node.js ≥ 18 required (≥ 20 recommended)
puppeteeris the onlynpmdependency — it self-contains Chromium- No global Chrome installation needed
- Works on macOS, Linux, and Windows (WSL)
- In CI/Docker, add
--disable-dev-shm-usage(already included in the script)
More from atypica-ai/marketing-skills
logo-design
Design professional logos as SVG code with browser preview. Use this skill when the user asks to design a logo, create a brand mark, make an icon, or build a visual identity. Also triggers on 'logo', 'brand mark', 'wordmark', 'monogram', 'icon design', 'visual identity', or 'design a logo for'. Outputs clean, scalable SVG files with full design rationale.
18plan-as-consultant
Plan a business research study the way a professional consultant would — selecting the right analytical framework (JTBD, KANO, STP, GE-McKinsey, etc.), designing the research method, and defining a specific actionable output. Use this skill when someone has a business question to research: product decisions, user understanding, market analysis, pricing strategy, brand positioning, feature prioritization, or competitive strategy. Triggers on phrases like 'how do I research this', 'help me plan a study', 'what framework should I use', 'I need to understand my users or market', or any request to structure business research.
17product-rnd
End-to-end Product Innovation R&D workflow — inspiration gathering, research, and professional report generation. Use whenever the user wants to create a product innovation or R&D report, develop a new product concept, conduct NPD research, or generate a structured output for a product or investor audience. Also triggers on "product innovation", "new product development", "product concept", "packaging design brief", or any request to generate a report around a product idea.
15market-sizing
Produce a rigorous, sourced TAM/SAM/SOM market sizing for any product or business. Use this skill whenever a user asks about market size, total addressable market, SAM, SOM, or market opportunity — across any industry including SaaS, AI tools, consumer brands, F&B, fashion, beauty, packaging, automotive, and more.
14atypica-user-interview
Run AI-simulated user interviews and focus group discussions using atypica.ai's library of human-like personas. Each persona is an AI that behaves like a real person — with a specific background, personality, and opinions. Use this skill whenever you need user research, product feedback, UX testing, or want to understand what different types of real people think, feel, or would do — without recruiting actual participants. Trigger on phrases like "interview users", "ask real people", "focus group", "user research", "talk to users", "get user feedback", "simulate interviews", "test with users", or any request to gather qualitative human insights.
12