Production Lines
Framework Exporters (shared)
Framework Exporters (shared)
Owner: Francois (Framework Specialist · Methodology) Authority: TFD-0022 Source request: MET-0008
Mutualized export pipeline for all framework rendering deliverables. Each exporter takes HTML + data.js and produces a downstream format.
Available
| Exporter | Input | Output | Notes |
|---|---|---|---|
html-to-pdf.js |
HTML page (file:// or local) | .pdf |
Playwright headless Chromium. Print CSS expanded. Color preserved. |
html-to-docx.py |
— | — | Lot 2 (Word .docx, reporté selon besoins clients) |
Setup (one-time)
npm install -g playwright
npx playwright install chromium
Usage
# Single file
node html-to-pdf.js path/to/A100-A280-solution-impacts.html
# Specific output path
node html-to-pdf.js page.html out.pdf
# Batch a directory
node html-to-pdf.js path/to/rendering/
# A4 landscape (default Letter portrait)
node html-to-pdf.js page.html --format=A4 --landscape
Behavior
@media printrules in_print.cssare honored — multi-mode templates (A100+A280) expand all 3 modes (Cible · Impacts · Tableau) sequentially with page breaks.- 800 ms idle wait after DOMContentLoaded lets
data.jsrender before capture. - Margins fixed at 14 mm top/bottom, 12 mm left/right.
- Color preserved via
printBackground: true+ page-levelprint-color-adjust: exactin shared CSS.
When to bump the wait
If the template uses Mermaid, additional fonts, or async fetches, increase the waitForTimeout in html-to-pdf.js or add a data-pdf-ready flag on <body> and await page.waitForSelector('body[data-pdf-ready]') instead.