Skip to content

render.preview

render.preview(input: RenderInput) -> PreviewResult

Generate paginated HTML preview output (spec §5.3).

Name Type Required Description
input RenderInput required Render input — accepts project mode OR inline mode.

PreviewResult — a PreviewResult with html, total_pages, and environment fields.

Code When
VALIDATION_ERROR The `data` mapping does not satisfy the template schema.
NOT_FOUND The `project/template` slug does not exist (project mode only).
MISSING_DATA Request body lacks the required `data` field.
QUOTA_EXCEEDED Per-key rate limit or monthly quota reached. Retryable.
# Demonstrates: client.render.preview(input) — accepts project mode OR inline mode.
from poli_page import PoliPage
client = PoliPage()
# Project mode: render the stored template's HTML preview.
preview = client.render.preview({
"project": "billing",
"template": "invoice",
"data": {"invoiceNumber": "INV-001", "total": 1280},
})
print(f"Preview: {preview.total_pages} pages, {preview.environment} env")
print(f"HTML length: {len(preview.html)}")