AgentGen icon

AgentGen

Generate PDFs and images from HTML using the AgentGen API

Generate PDF

AI-generated

Summary

Render HTML to a PDF via the AgentGen API, supporting single-page or multi-page output.

Inputs

  • pdfMode — One HTML input → one-page PDF; JSON array of page objects → multi-page PDF. Default: singlePage.
  • pdfHtml (required) — HTML content to render (max 500 KB). Shown when pdfMode is singlePage.
  • pdfOptions — Collection of format, orientation, and margin options for single-page PDF. Shown when pdfMode is singlePage.
  • pdfPages (required) — JSON array of page objects. Each object accepts: html (required), format, width, height, landscape, print_background, margin ({ top, bottom, left, right }). Shown when pdfMode is multiPage.

Output shape

JSON response from the AgentGen API containing PDF data.

Costs 2 tokens per page.

Examples

Example 1: Single-page PDF

Set pdfMode to singlePage, provide pdfHtml, optionally adjust pdfOptions (format, landscape, print_background, margins).

Example 2: Multi-page PDF

Set pdfMode to multiPage, provide pdfPages as a JSON array of page objects, each with at least an html property and optional format/landscape/print_background/margin.

Links

Discussion