Skip to main content
Glama

HTML to PDF Document Generator API - A4/Letter

html_to_pdf_api
Read-onlyIdempotent

Convert HTML documents, invoices, certificates, and reports with inline CSS and base64 data-URI images into printable A4 or Letter PDFs. SSRF-safe offline rendering strips external scripts and remote links automatically. Deterministic output with page count and SHA-256 digest, nothing stored. Free: 5 calls/day per IP. Paid: Radar API key (from €15/mo at https://radarbg.com/pricing#starter via X-API-Key) or $0.01/call via x402 at https://radarbg.com/x402/html-to-pdf-api.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "html": "<h1>Statement of Account</h1><p>Account: <b>DE89-3704-0044</b></p><table><tr><th>Date</th><th>Description</th><th>Amount</th></tr><tr><td>2026-12-01</td><td>Platform Subscription</td><td>149.00 EUR</td></tr></table>",
      "fileName": "statement.pdf",
      "marginMm": 15,
      "pageSize": "A4"
    },
    "name": "html_to_pdf_api"
  }
}

Input Schema

NameRequiredDescriptionDefault
htmlNoRaw HTML markup string (provide either html or fileBase64, max 5 MB).
fileNameNoOptional output file name (e.g. invoice-104.pdf).
marginMmNoPage margin in millimeters (5-40).
pageSizeNoPDF page size: A4 or Letter.A4
fileBase64NoBase64-encoded .html file (alternative to html).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Well beyond the annotations, the description discloses offline SSRF-safe rendering, automatic stripping of external scripts/remote links, deterministic output, page count plus SHA-256 digest, and that nothing is stored. It also gives concrete rate limits (5 calls/day per IP) and both auth paths (X-API-Key or x402 per-call payment), which the readOnly/idempotent hints alone would not convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with what the tool does and its key guarantees, then commercial terms. The pricing URL block is dense but each clause carries actionable information (auth method, quota, cost); only the two long pricing links could be trimmed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description covers the return values itself (page count and SHA-256 digest), plus limits, safety behavior, storage policy, auth, and quota. For a stateless conversion tool this leaves no operational question an agent would need answered before invoking it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning the schema does not: the html input is restricted in practice to inline CSS and base64 data-URI images, which tells an agent what content will actually render. It adds nothing further about fileName, marginMm, or pageSize, which the schema already documents fully.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource — converting HTML documents (invoices, certificates, reports) into printable A4/Letter PDFs — and pins down the accepted input flavor (inline CSS, base64 data-URI images). It clearly differentiates itself from siblings by input format, though it never names an alternative such as markdown_to_pdf_api or base64_to_pdf.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied through the supported-input constraints (inline CSS, data-URI images only, external scripts and remote links stripped) and the free-tier quota, which tells an agent when the tool will fail. However, there is no explicit statement of when to prefer this over sibling converters, so the agent must infer routing from the input format alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources