generate_pdf
Convert web pages or HTML content into PDF files with customizable margins, headers, footers, page ranges, and scaling options.
Instructions
Generate a PDF from a URL or HTML content. Supports custom margins, headers/footers, page ranges, and scaling. Saves the PDF to disk and returns the file path.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL to render as PDF (required if no html) | |
| html | No | Raw HTML to render as PDF (required if no url) | |
| format | No | Paper format: A4, Letter, Legal, Tabloid, A3, A5 (default: A4) | |
| landscape | No | Landscape orientation (default: false) | |
| printBackground | No | Include CSS backgrounds (default: true) | |
| margin | No | CSS margin — string for all sides (e.g. "1cm") or object { top, right, bottom, left } | |
| scale | No | Rendering scale 0.1-2 (default: 1) | |
| width | No | Page width (overrides format) — CSS value like "8.5in" | |
| pageRanges | No | Page ranges to include, e.g. "1-5, 8" | |
| headerTemplate | No | HTML template for page header (uses Chromium templating) | |
| footerTemplate | No | HTML template for page footer | |
| displayHeaderFooter | No | Show header and footer (default: false) | |
| delay | No | Milliseconds to wait before rendering (default: 0) | |
| saveTo | No | Output file path (default: ./output.pdf) |