Render PDF
Cloudflare Browser Run
Cloudflare Browser Run
Render PDF
Render a webpage to a PDF document and return it as a file.
ActionAI Tool
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
url | text | Required | The URL to render as PDF. Provide either url or html. |
html | text | Optional | Raw HTML to render instead of a URL. |
pdfOptions | object | Optional | PDF output options. |
format | select | Optional | Paper format. (options: Letter, Legal, A4, A3, A5, Tabloid) |
landscape | yes/no | Optional | Use landscape orientation. |
printBackground | yes/no | Optional | Print background graphics. |
scale | number | Optional | Scale of the webpage rendering (0.1 - 2). |
pageRanges | text | Optional | Page ranges to print, e.g. '1-5, 8'. |
displayHeaderFooter | yes/no | Optional | Display header and footer. |
headerTemplate | text | Optional | HTML template for the print header. |
footerTemplate | text | Optional | HTML template for the print footer. |
margin | object | Optional | Page margins. |
top | text | Optional | Top margin, e.g. '1cm'. |
bottom | text | Optional | Bottom margin. |
left | text | Optional | Left margin. |
right | text | Optional | Right margin. |
viewport | object | Optional | Viewport dimensions and device settings. |
width | number | Optional | Viewport width in pixels. |
height | number | Optional | Viewport height in pixels. |
deviceScaleFactor | number | Optional | Device scale factor (pixel density). |
gotoOptions | object | Optional | Navigation options controlling how the page is loaded. |
waitUntil | select | Optional | When to consider navigation finished. (options: Load, DOM Content Loaded, Network Idle 0, Network Idle 2) |
timeout | number | Optional | Maximum navigation time in milliseconds. |
referer | text | Optional | Referer header value. |
cookies | array of object | Optional | Cookies to set before loading the page. |
name | text | Required | Cookie name. |
value | text | Required | Cookie value. |
domain | text | Optional | Cookie domain. |
url | text | Optional | Cookie URL. |
path | text | Optional | Cookie path. |
authenticate | object | Optional | HTTP basic auth credentials. |
username | text | Optional | HTTP auth username. |
password | text | Optional | HTTP auth password. |
setExtraHTTPHeaders | dynamic object | Optional | Extra HTTP headers to send with the request. |
userAgent | text | Optional | Custom user agent string. |
waitForSelector | text | Optional | Wait for this CSS selector before rendering. |
addStyleTag | array of object | Optional | Inject CSS before capture. |
url | text | Optional | External stylesheet URL. |
content | text | Optional | Inline CSS content. |
rejectResourceTypes | array of text | Optional | Resource types to block. |
Outputs
| Name | Type | Description |
|---|---|---|
statusCode | number | HTTP status code. |
body | object | Result containing the generated file. |
file | attachments | The generated PDF file, uploaded to the file store. |
contentType | text | MIME type of the generated file. |
size | number | File size in bytes. |