{
  "name": "html-to-pdf",
  "summary": "Renders a web page or an inline HTML string to a PDF, returned base64-encoded with its page count.",
  "rationale": "It needs a headless browser AND a hardened fetch: an agent that renders a URL itself walks the browser straight past every SSRF control, and carrying a Chromium is not something an agent does per call.",
  "family": "documents",
  "price_usd": "0.005",
  "free": false,
  "timeout_ms": 12000,
  "max_timeout_seconds": 33,
  "input_schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "url": {
        "description": "Absolute http(s) URL of an HTML or XHTML page to fetch and render, up to 2048 characters; redirects are followed, the body is capped at 5 MB, and exactly one of url or html is required.",
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      },
      "html": {
        "type": "string",
        "minLength": 1,
        "maxLength": 262144,
        "description": "Self-contained HTML. Inline PNG data images are supported; external images, stylesheets and fonts are blocked. JavaScript is disabled."
      },
      "format": {
        "default": "A4",
        "description": "Paper size of every page, A4 by default.",
        "type": "string",
        "enum": [
          "A3",
          "A4",
          "A5",
          "Letter",
          "Legal",
          "Tabloid"
        ]
      },
      "landscape": {
        "default": false,
        "description": "Print in landscape orientation instead of portrait.",
        "type": "boolean"
      }
    },
    "additionalProperties": false
  },
  "input_example": {
    "url": "https://grist.tools/samples/web/render-print.html",
    "format": "A4",
    "landscape": false
  },
  "output_example": {
    "source_url": "https://grist.tools/samples/web/render-print.html",
    "pages": 1,
    "bytes": 38404,
    "format": "A4",
    "landscape": false,
    "pdf_base64": "JVBERi0xLjcKJYGBgYEKCjYgMCBvYmoKPDwKL0ZpbHRlciAvRmxhdGVEZWNvZGUK...",
    "rendered_at": "2026-09-01T12:00:00.000Z"
  },
  "errors": [
    "invalid_input",
    "blocked_target",
    "unreachable_target",
    "upstream_timeout",
    "too_large",
    "unprocessable",
    "internal"
  ]
}