render.document
render.document(input: ProjectModeInput) -> DocumentDescriptor Render a PDF, store it server-side, return the descriptor (spec §5.2).
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
input | ProjectModeInput | required | Project-mode render input. Same shape as `render.pdf`. |
Returns
Section titled “Returns”DocumentDescriptor — a DocumentDescriptor whose download_pdf() fetches the bytes on demand.
Errors
Section titled “Errors”| Code | When |
|---|---|
VALIDATION_ERROR | The `data` mapping does not satisfy the template schema. |
NOT_FOUND | The `project/template` slug does not exist. |
PROJECT_REQUIRED_FOR_DOCUMENT | Inline-shaped input was passed. Rejected locally before the HTTP call. |
QUOTA_EXCEEDED | Per-key rate limit or monthly quota reached. Retryable. |
INTERNAL_ERROR | The API returned 5xx. Retryable. |
Example
Section titled “Example”# Demonstrates: client.render.document(input) — render and store a PDF server-side.from poli_page import PoliPage
client = PoliPage()
document = client.render.document({ "project": "billing", "template": "invoice", "data": {"invoiceNumber": "INV-001", "total": 1280}, "metadata": {"customerId": "cust_42"},})
# `document.document_id` identifies the stored document — use it with# client.documents.* to fetch, preview, thumbnail, or delete later.print( f"Stored as {document.document_id} " f"({document.page_count} pages, {document.size_bytes} bytes)")
# Fetch the PDF bytes on demand:pdf = document.download_pdf()print(f"Downloaded {len(pdf)} bytes")