generate_pdf
Convert a web page or HTML content into a PDF document. Returns the PDF as a base64-encoded string for direct use.
Instructions
Generate a PDF from a web page or HTML content. Returns the PDF as a base64-encoded string.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL of the page to render. Exactly one of url or html is required. | |
| html | No | Raw HTML to render. Exactly one of url or html is required. | |
| format | No | Paper size. | A4 |
| orientation | No | Page orientation. | portrait |
| print_background | No | Print background graphics and colors. | |
| wait_for | No | When to consider the page loaded: load | dom_content_loaded | network_idle | commit | CSS selector. | dom_content_loaded |
| delay_ms | No | Extra delay in milliseconds after page load before capturing. | |
| ai_cleanup | No | Remove cookie banners/popups before capture. 'fast' uses JS heuristics (1 credit). 'thorough' adds an LLM pass (3 credits; requires Anthropic key on the server). | |
| headers | No | Custom HTTP headers to send with the render request. Use for Bearer tokens, X-Tenant-Id, etc. Host / Cookie / Content-Length / Sec-* / Connection are rejected server-side. Max 30 headers, values ≤ 2 KB. | |
| cookies | No | Session cookies to inject before page navigation. Each cookie needs either 'domain' or 'url'. Max 50 per request. | |
| basic_auth | No | HTTP Basic auth credentials. Forwarded to the headless browser on a 401 challenge. | |
| output_path | No | Absolute or relative path to save the PDF file (e.g. /tmp/invoice.pdf). If omitted, the PDF is returned as base64 in the response. |