Skip to content

render.pdf

render.pdf(input: ProjectModeInput) -> bytes

Render a PDF and return its raw bytes (two HTTP calls: render + S3).

Name Type Required Description
input ProjectModeInput required Project-mode render input (`project`, `template`, `data`, plus optional `version`, `format`, `orientation`, `locale`, `metadata`, `idempotency_key`).

bytes — the rendered PDF as raw bytes.

Code When
VALIDATION_ERROR The `data` mapping does not satisfy the template schema.
NOT_FOUND The `project/template` slug does not exist.
QUOTA_EXCEEDED Per-key rate limit or monthly quota reached. Retryable.
timeout Request exceeded the configured `timeout`. Retryable.
network_error TCP/TLS-level failure reaching the API. Retryable.
INTERNAL_ERROR The API returned 5xx. Retryable.
DOWNLOAD_FAILED The S3 second-hop download for the rendered PDF failed.
# Demonstrates: client.render.pdf(input) — project mode only.
from poli_page import PoliPage
client = PoliPage() # picks up POLI_PAGE_API_KEY from the environment
pdf = client.render.pdf({
"project": "billing",
"template": "invoice",
"data": {"invoiceNumber": "INV-001", "total": 1280},
})
# `pdf` is a `bytes` object containing the PDF.
print(f"Rendered {len(pdf)} bytes")