VisualActive
HTML to PDF
Render a URL or raw HTML string to PDF. Returns pdf_base64 (base64 PDF — decode to get raw bytes) and page_count. Provide url OR html — never both. Supports format (A4/Letter/Legal), landscape boolean, and margin settings (top/bottom/left/right in CSS units). Use for invoices, reports, or printable document generation.
Input Schema
{
"description": "Provide either 'url' OR 'html' (not both). Common fields (format, landscape, margin) apply to both.",
"oneOf": [
{
"type": "object",
"required": [
"url"
],
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "URL to render as PDF (must be publicly accessible)"
},
"format": {
"type": "string",
"enum": [
"A4",
"Letter",
"Legal"
],
"default": "A4",
"description": "Page format"
},
"landscape": {
"type": "boolean",
"default": false,
"description": "Landscape orientation"
},
"margin": {
"type": "object",
"description": "Page margins (CSS units, e.g. '1cm', '10mm', '0.5in')",
"properties": {
"top": {
"type": "string",
"default": "1cm"
},
"bottom": {
"type": "string",
"default": "1cm"
},
"left": {
"type": "string",
"default": "1cm"
},
"right": {
"type": "string",
"default": "1cm"
}
}
}
}
},
{
"type": "object",
"required": [
"html"
],
"properties": {
"html": {
"type": "string",
"description": "Raw HTML string to render as PDF"
},
"format": {
"type": "string",
"enum": [
"A4",
"Letter",
"Legal"
],
"default": "A4",
"description": "Page format"
},
"landscape": {
"type": "boolean",
"default": false,
"description": "Landscape orientation"
},
"margin": {
"type": "object",
"description": "Page margins (CSS units, e.g. '1cm', '10mm', '0.5in')",
"properties": {
"top": {
"type": "string",
"default": "1cm"
},
"bottom": {
"type": "string",
"default": "1cm"
},
"left": {
"type": "string",
"default": "1cm"
},
"right": {
"type": "string",
"default": "1cm"
}
}
}
}
}
]
}
Output Schema
{
"type": "object",
"required": [
"pdf_base64",
"page_count",
"file_size_bytes",
"generated_at"
],
"properties": {
"pdf_base64": {
"type": "string",
"description": "Base64-encoded PDF bytes (decode to get raw PDF file)"
},
"page_count": {
"type": "integer",
"description": "Number of pages in the generated PDF"
},
"file_size_bytes": {
"type": "integer",
"description": "Size of the PDF in bytes"
},
"generated_at": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp of generation"
}
},
"example": {
"pdf_base64": "JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PC9...",
"page_count": 2,
"file_size_bytes": 14867,
"generated_at": "2026-04-07T12:00:00.000Z"
}
}