generate_pdf
Convert a webpage URL or raw HTML to a PDF document. Supports page size, orientation, margins, and background printing. Returns PDF as base64.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| css | No | Custom CSS to inject before PDF generation | |
| url | No | URL to convert to PDF (provide url OR html, not both) | |
| html | No | Raw HTML to convert to PDF (provide html OR url, not both) | |
| locale | No | BCP 47 locale tag for the browser context (e.g., "en-US") | |
| cookies | No | Cookies to set before capture (e.g., [{"name": "session", "value": "abc123"}]) | |
| headers | No | Custom HTTP headers to send with the request (e.g., {"Authorization": "Bearer token"}) | |
| evaluate | No | JavaScript code to execute on the page before PDF generation (max 10KB). Runs in the browser context. | |
| latitude | No | Geolocation latitude (-90 to 90) | |
| timezone | No | IANA timezone for the browser context (e.g., "America/New_York") | |
| block_ads | No | Block ads and trackers | |
| dark_mode | No | Enable dark mode emulation | |
| landscape | No | Landscape orientation (default: false) | |
| longitude | No | Geolocation longitude (-180 to 180) | |
| pdf_scale | No | Content scale 0.1-2 (default: 1) | |
| pdf_format | No | Page size (default: A4) | |
| wait_until | No | Page load strategy (default: domcontentloaded). Use "networkidle" for SPAs. | |
| print_background | No | Include background colors/images (default: true) | |
| disable_javascript | No | Disable JavaScript execution on the page | |
| ignore_https_errors | No | Ignore HTTPS/TLS certificate errors |