Portal Community

When to Use

  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

FieldRequiredDescription
BaseUrlRequiredBrowserless instance URL.
TokenOptionalAPI token for cloud Browserless.

Operation

FieldRequiredDescription
urlRequiredThe page URL to print. Supports BizFirst expressions.
optionsOptionalPDF 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).
gotoOptionsOptionalNavigation options JSON: waitUntil and timeout.
waitForSelectorOptionalWait for a CSS selector before printing.
waitForTimeoutOptionalFixed delay in milliseconds before printing.
emulateMediaTypeOptionalSet to "print" to apply print CSS rules, or "screen" to capture the screen rendering as PDF.
authenticateOptionalHTTP Basic auth credentials: { "username": "...", "password": "..." }.
setExtraHTTPHeadersOptionalAdditional request headers, e.g. auth bearer tokens.
cookiesOptionalCookies to set before navigation.
blockAdsOptionalDefault true.
bestAttemptOptionalDefault true. Return a PDF even if some sub-resources failed to load.
useCustomBodyOptionalSend customBodyJson verbatim as the request body.
customBodyJsonOptionalRaw 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 CodeCause
VAL_MISSING_URLurl is empty and no html source was provided.
CFG_INVALIDNode settings could not be resolved to a PDF configuration.
BROWSERLESS_BAD_REQUESTcustomBodyJson is not valid JSON or does not match the PDF request shape.

Output

Success Port

FieldTypeDescription
statusstringAlways "success".
errorCodestringAlways empty on success.
operationstringAlways "pdf".
urlstringURL that was rendered.
mimeTypestringAlways "application/pdf".
fileNamestringSuggested file name, e.g. "document.pdf".
sizeBytesintPDF size in bytes.
databytesRaw PDF bytes. Pass to an S3 upload, email attachment, or file-write node.

Error Port

FieldTypeDescription
statusstringAlways "error".
errorCodestringMachine-readable error code.
errorMessagestringHuman-readable failure description.
operationstringAlways "pdf".
httpStatusCodeintHTTP 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

ExpressionValue
{{ $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

PolicyRecommendationSeverity
URL validationValidate and allowlist target domains before passing user-supplied URLs to prevent SSRF.High
Token storageStore the API token in a workflow secret — never hardcode in configuration JSON.Critical
PDF file sizePDFs 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 pagesPages with charts, fonts, or heavy JS can take longer to render. Set gotoOptions.timeout to at least 30 s for such pages.Medium
printBackground defaultBackgrounds 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 } }) }}"
}