{
  "name": "markdown-to-pdf",
  "summary": "Renders a Markdown document to a PDF, returned base64-encoded with its page count.",
  "rationale": "Turning styled Markdown into a paginated PDF needs a real layout engine 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 a UTF-8 Markdown text file to fetch and render, up to 2048 characters; redirects are followed, the body is capped at 2 MB, and exactly one of url or markdown is required.",
        "type": "string",
        "maxLength": 2048,
        "format": "uri"
      },
      "markdown": {
        "type": "string",
        "minLength": 1,
        "maxLength": 262144,
        "description": "Markdown with escaped raw HTML. PNG/JPEG/GIF/WebP data-image syntax is accepted; SVG data images and external image loading are blocked."
      },
      "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/documents/render-notes.md",
    "format": "A4",
    "landscape": false
  },
  "output_example": {
    "source_url": "https://grist.tools/samples/documents/render-notes.md",
    "pages": 1,
    "bytes": 69844,
    "format": "A4",
    "landscape": false,
    "pdf_base64": "JVBERi0xLjcKJYGBgYEKCjkgMCBvYmoKPDwKL0ZpbHRlciAvRmxhdGVEZWNvZGUK...",
    "rendered_at": "2026-09-01T12:00:00.000Z"
  },
  "errors": [
    "invalid_input",
    "blocked_target",
    "unreachable_target",
    "upstream_timeout",
    "unsupported_content_type",
    "too_large",
    "unprocessable",
    "internal"
  ]
}