When to Use
- Invoice and receipt generation: Render an HTML invoice template at a dynamic URL to PDF and attach it to a customer email or store it in document management.
- Report archiving: Convert analytics dashboards, financial summaries, or compliance reports to PDF on a schedule for long-term archiving.
- Contract generation: Render a populated contract template to PDF as part of an e-signature or HR workflow.
- Regulatory document capture: Save the rendered state of a web-based regulatory filing or submission as a PDF proof of record.
- Client-facing deliverables: Convert data-driven proposal pages to PDF and deliver them automatically via email or a client portal upload.
Print CSS matters: Browserless uses Chrome's print engine. Pages with a @media print stylesheet will render differently from the screen view. Test your target page's print CSS before relying on this node in production.
Configuration
Connection
| Field | Required | Description |
BaseUrl | Required | Browserless instance URL. |
Token | Optional | API token for cloud Browserless. |
Operation
| Field | Required | Description |
url | Required | The page URL to print. Supports BizFirst expressions. |
options | Optional | PDF options JSON object. Key fields: format ("A4", "Letter", "Legal", etc.), landscape (bool), printBackground (bool, default false), margin (object with top, bottom, left, right as CSS strings), scale (number, default 1), displayHeaderFooter (bool), headerTemplate and footerTemplate (HTML strings). |
gotoOptions | Optional | Navigation options JSON: waitUntil and timeout. |
waitForSelector | Optional | Wait for a CSS selector before printing. |
waitForTimeout | Optional | Fixed delay in milliseconds before printing. |
emulateMediaType | Optional | Set to "print" to apply print CSS rules, or "screen" to capture the screen rendering as PDF. |
authenticate | Optional | HTTP Basic auth credentials: { "username": "...", "password": "..." }. |
setExtraHTTPHeaders | Optional | Additional request headers, e.g. auth bearer tokens. |
cookies | Optional | Cookies to set before navigation. |
blockAds | Optional | Default true. |
bestAttempt | Optional | Default true. Return a PDF even if some sub-resources failed to load. |
useCustomBody | Optional | Send customBodyJson verbatim as the request body. |
customBodyJson | Optional | Raw JSON body when useCustomBody is true. |
Sample Configuration
{
"operation": "pdf",
"baseUrl": "https://chrome.browserless.io",
"token": "{{ $env.BROWSERLESS_TOKEN }}",
"url": "https://app.example.com/invoices/{{ $input.invoiceId }}",
"options": {
"format": "A4",
"landscape": false,
"printBackground": true,
"margin": {
"top": "20mm",
"bottom": "20mm",
"left": "15mm",
"right": "15mm"
},
"displayHeaderFooter": true,
"footerTemplate": "<div style='font-size:10px;text-align:center;width:100%;'>Invoice #{{ $input.invoiceId }} — Page <span class='pageNumber'></span> of <span class='totalPages'></span></div>"
},
"emulateMediaType": "print",
"gotoOptions": { "waitUntil": "networkidle2", "timeout": 30000 },
"waitForSelector": { "selector": ".invoice-total", "timeout": 10000 }
}
Validation Errors
| Error Code | Cause |
VAL_MISSING_URL | url is empty and no html source was provided. |
CFG_INVALID | Node settings could not be resolved to a PDF configuration. |
BROWSERLESS_BAD_REQUEST | customBodyJson is not valid JSON or does not match the PDF request shape. |
Output
Success Port
| Field | Type | Description |
status | string | Always "success". |
errorCode | string | Always empty on success. |
operation | string | Always "pdf". |
url | string | URL that was rendered. |
mimeType | string | Always "application/pdf". |
fileName | string | Suggested file name, e.g. "document.pdf". |
sizeBytes | int | PDF size in bytes. |
data | bytes | Raw PDF bytes. Pass to an S3 upload, email attachment, or file-write node. |
Error Port
| Field | Type | Description |
status | string | Always "error". |
errorCode | string | Machine-readable error code. |
errorMessage | string | Human-readable failure description. |
operation | string | Always "pdf". |
httpStatusCode | int | HTTP status code from Browserless, if available. |
Sample Output
{
"status": "success",
"errorCode": "",
"operation": "pdf",
"url": "https://app.example.com/invoices/INV-2026-0042",
"mimeType": "application/pdf",
"fileName": "document.pdf",
"sizeBytes": 143360,
"data": "<binary PDF bytes>"
}
Expression Reference
| Expression | Value |
{{ $output.BrowserlessNode.mimeType }} | Always "application/pdf". |
{{ $output.BrowserlessNode.fileName }} | Suggested file name for storage. |
{{ $output.BrowserlessNode.sizeBytes }} | PDF size in bytes. |
{{ $output.BrowserlessNode.data }} | Raw PDF bytes. |
{{ $output.BrowserlessNode.url }} | URL that was rendered. |
Node Policies & GuardRails
| Policy | Recommendation | Severity |
| URL validation | Validate and allowlist target domains before passing user-supplied URLs to prevent SSRF. | High |
| Token storage | Store the API token in a workflow secret — never hardcode in configuration JSON. | Critical |
| PDF file size | PDFs with many images or charts can be large. Set a workflow file size limit and use rejectResourceTypes: ["image"] if images are not needed in the PDF. | Medium |
| Timeout for complex pages | Pages with charts, fonts, or heavy JS can take longer to render. Set gotoOptions.timeout to at least 30 s for such pages. | Medium |
| printBackground default | Backgrounds and colors are off by default in Chrome's PDF print engine. Set options.printBackground: true to match the visual design of your template. | Low |
Examples
Example 1 — A4 invoice PDF with background and footer
{
"operation": "pdf",
"baseUrl": "https://chrome.browserless.io",
"token": "{{ $env.BROWSERLESS_TOKEN }}",
"url": "https://billing.example.com/invoice/{{ $input.invoiceId }}?token={{ $env.BILLING_PREVIEW_TOKEN }}",
"options": {
"format": "A4",
"printBackground": true,
"margin": { "top": "15mm", "bottom": "15mm", "left": "12mm", "right": "12mm" }
},
"emulateMediaType": "print",
"gotoOptions": { "waitUntil": "networkidle0", "timeout": 30000 }
}
Example 2 — Landscape Letter report PDF
{
"operation": "pdf",
"baseUrl": "https://chrome.browserless.io",
"token": "{{ $env.BROWSERLESS_TOKEN }}",
"url": "https://reports.example.com/monthly/{{ $input.month }}",
"options": {
"format": "Letter",
"landscape": true,
"printBackground": true
},
"gotoOptions": { "waitUntil": "networkidle2", "timeout": 40000 },
"waitForSelector": { "selector": ".report-chart", "timeout": 15000 }
}
Example 3 — PDF from HTML string (no URL)
{
"operation": "pdf",
"baseUrl": "https://chrome.browserless.io",
"token": "{{ $env.BROWSERLESS_TOKEN }}",
"useCustomBody": true,
"customBodyJson": "{{ $json.encode({ 'html': $input.htmlContent, 'options': { 'format': 'A4', 'printBackground': true } }) }}"
}