Advanced Options – Headless Chrome

For the Headless Chrome endpoint, you have the ability to pass in a variety of advanced options as a JSON object as part of the payload. Below are the set of options that we support with headless chrome.

The Chrome version currently running in production: 144

Sample Payload with Advanced Options


    {
        "html": "Hello World",
        "options": {
            "landscape": true
        }
    }

Attribute

Type

Description

landscape

Boolean

Paper orientation. Defaults to false.

displayHeaderFooter

Boolean

Display header and footer. Defaults to false.

printBackground

Boolean

Print background graphics. Defaults to false.

scale

Number

Scale of the webpage rendering. Defaults to 1.

width

String

Paper width in inches. Defaults to "8.27in".

height

String

Paper height in inches. Defaults to "11.69in".

marginBottom

String

Bottom margin in inches. Defaults to ".4in".

marginLeft

String

Left margin in inches. Defaults to ".4in".

marginRight

String

Right margin in inches. Defaults to ".4in".

marginTop

String

Top margin in inches. Defaults to ".4in".

pageRanges

String

Paper ranges to print, e.g., ‘1-5, 8, 11-13’. Defaults to the empty string, which means print all pages.

headerTemplate

String

HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: –

  • date: formatted print date

  • title: document title

  • url: document location

  • pageNumber: current page number

  • totalPages: total pages in the document

For example, <span class=”title”></span> would generate span containing the title.

footerTemplate

String

HTML template for the print footer. Should use the same format as the `headerTemplate`.

preferCSSPageSize

Boolean

Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.

delay

Integer

The amount of time to wait for the page to render before taking screenshot or PDF (in milliseconds). Defaults to 0.

puppeteerWaitForMethod

String

Acceptable values are WaitForNavigation, WaitForExpression, WaitForFunction, WaitForSelector. See more details here.

puppeteerWaitForValue

String

WaitForNavigation, the only acceptable values are domcontentloaded, load, networkidle0, networkidle2.

omitBackground

String

Transparent background on PDF