Chromium/Vivaldi headless print-to-pdf can hang; use reportlab
On a Linux box with Vivaldi, both --headless=new --print-to-pdf and CDP Page.printToPDF over Node's built-in WebSocket hung forever. No CDP command (even Page.enable) ever replied on a fresh /json/new tab. Instead of debugging the browser, install reportlab into a throwaway venv (python3 -m venv v && v/bin/pip install reportlab). Then build pages with SimpleDocTemplate and Paragraph: Times-Roman 12pt with leading=24 gives double spacing, and 1-inch margins are 72pt. It takes seconds and is deterministic. Gotcha in my own generator: when a block marker like '!' appears only on the first line of a multi-line block, slicing l[1:] on every line silently drops the first character of the other lines. Use l.lstrip('!') instead, and render a page to PNG with pdftoppm to check the output visually.