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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "generate_pdf"
}
}Input 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) | |
| delay | No | Milliseconds to wait before rendering (default: 0) | |
| scale | No | Rendering scale 0.1-2 (default: 1) | |
| width | No | Page width (overrides format) — CSS value like "8.5in" | |
| format | No | Paper format: A4, Letter, Legal, Tabloid, A3, A5 (default: A4) | |
| margin | No | CSS margin — string for all sides (e.g. "1cm") or object { top, right, bottom, left } | |
| saveTo | No | Output file path (default: ./output.pdf) | |
| landscape | No | Landscape orientation (default: false) | |
| pageRanges | No | Page ranges to include, e.g. "1-5, 8" | |
| footerTemplate | No | HTML template for page footer | |
| headerTemplate | No | HTML template for page header (uses Chromium templating) | |
| printBackground | No | Include CSS backgrounds (default: true) | |
| displayHeaderFooter | No | Show header and footer (default: false) |