📄 HTML → PDF/DOCX Converter v18.0

v18.0 NEW: DOCX PATHWAY
✓ mode: 'docx' or 'word' → Word document
✓ Same iterative page-fitting algorithm as PDF
✓ Page count via LibreOffice → PDF conversion
✓ Orphan heading handling, coverage tracking
PDF Features (from v17.9.1):
✓ Tiling: Oversized visuals sliced into multiple pages
✓ Coverage audit: Tracks all blocks, reports missing content
✓ Emergency fallback: Falls back to page.pdf() if coverage < 95%
✓ Visual container detection, embedded videos, clickable images
✓ Unified list handling: listMode = together | split | smart

Endpoints

GET /health
Health check
POST /convert
Convert HTML → PDF or DOCX
Body: { html, mode?, listMode?, filename? }
mode: portrait (default), landscape, docx, word, pdf-paginated, pdf-legacy
listMode: smart (default), together, split
POST /debug/convert
Convert with debug session (stores intermediate artifacts)
POST /debug/blocks
Extract blocks only (Stage 1) - returns session info
GET /debug/session/:id/intermediate
Get intermediate HTML (all blocks before pagination)
GET /debug/session/:id/blocks
Get extracted blocks JSON
GET /debug/session/:id/final
Get final merged PDF or DOCX