Generate PDFs from HTML in n8n Cloud using only a Code node
n8n Cloud does not allow installing PDF libraries in Code nodes, so the author wrote a plain JavaScript generator that builds PDF files directly. The tool can be tested in a browser before being pasted into an n8n Code node, which then returns the PDF as binary data from items containing an HTML field. It handles headings, paragraphs, lists, line breaks, preformatted text, horizontal rules and common HTML entities on A4 pages with automatic page breaks. It does not support CSS, images, tables, links, inline bold or italics, or non-Latin text, so browser-based PDF services remain better for pixel-perfect output. The workflow was tested in n8n Cloud in October 2026, and the code and importable workflow are available free under the MIT license.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in