CustomJS provides powerful PDF generation capabilities that allow you to create professional PDF documents directly from your Make.com workflows. You can generate PDFs from HTML content, templates, or dynamic data.

The PDF generation module uses Chromium-based rendering for PDF generation, which means:
<h1>Hello World</h1>
The module returns a binary file buffer that can be directly used with other Make.com modules like Google Drive, Dropbox, or email attachments.
You can directly access input field values using the 'input' JavaScript variable, or construct JSON objects for complex cases, as detailed in our JSON Parameter guide.


You can use external JavaScript libraries like QRCode.js in your PDF templates. When using ES Modules, wrap your import in a module script tag:
<script type="module">
import QRCode from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm';
// Generate QR code
const qrDataUrl = await QRCode.toDataURL('https://example.com', {
width: 150,
margin: 1
});
// Set the image source
document.getElementById('qr').src = qrDataUrl;
</script>
<img id="qr" alt="QR Code" /> 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!