All nodes are available on both n8n Cloud and self-hosted n8n and require you to install the CustomJS community package. See Installation.
The HTML to PDF node allows you to generate PDF files from HTML using n8n. Unlike raw text-based PDFs, using HTML and CSS allows for beautifully formatted documents, including tables, colors, and branding.
When using asynchronous JavaScript (QR codes, charts, API calls), you must signal when your content is ready by setting window.__RENDER_DONE__ = true. The PDF generator waits for this flag before capturing the page.
<script type="module">
import QRCode from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm';
// Initialize as false
window.__RENDER_DONE__ = false;
async function generateQR() {
// Your async operations
const qrDataUrl = await QRCode.toDataURL('https://example.com');
document.getElementById('qr').src = qrDataUrl;
// Signal that rendering is complete
window.__RENDER_DONE__ = true;
}
// Start generation
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', generateQR);
} else {
generateQR();
}
</script>
⚠️ Important: Without setting window.__RENDER_DONE__ = true, your PDF may be blank or incomplete because the generator won't wait for async operations to finish!
Generate branded PDF quotes, proposals, and contracts straight from Pipedrive deal data. Three approaches, from a free static link to a native webhook that works on every plan. 600 free PDFs/month.
Generate branded PDFs - invoices, NDAs, quotes, certificates - straight from HubSpot data. Three approaches, from a free no-code link to fully automated workflows. 600 free PDFs/month.
Learn how to automate PDF generation in Make.com with CustomJS. Step-by-step guide with templates for invoices, HTML to PDF, and page extraction. 600 free PDFs/month.