render.pdf_stream
render.pdf_stream(input: ProjectModeInput) -> ContextManager[Iterator[bytes]] Render a PDF and return a streaming context manager (plan §5.6).
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
input | ProjectModeInput | required | Project-mode render input. Same shape as `render.pdf`. |
Returns
Section titled “Returns”ContextManager[Iterator[bytes]] — a context manager yielding Iterator[bytes] chunks of the PDF stream.
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. |
QUOTA_EXCEEDED | Per-key rate limit or monthly quota reached. Retryable. |
INTERNAL_ERROR | The API returned 5xx. Retryable. |
DOWNLOAD_FAILED | The S3 second-hop streaming download failed. |
Example
Section titled “Example”# Demonstrates: client.render.pdf_stream(input) — project mode only.from poli_page import PoliPage
client = PoliPage()
# `pdf_stream` returns a context manager yielding chunks of bytes.total = 0with client.render.pdf_stream({ "project": "billing", "template": "invoice", "data": {"invoiceNumber": "INV-001", "total": 1280},}) as chunks: for chunk in chunks: total += len(chunk)
print(f"Streamed {total} bytes")