documents.preview
documents.preview(id: str) -> DocumentPreviewResult Retrieve stored paginated HTML + page count (spec §6.2).
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id | str | required | The `document_id` of the stored document to preview. |
Returns
Section titled “Returns”DocumentPreviewResult — a DocumentPreviewResult with html and page_count.
Errors
Section titled “Errors”| Code | When |
|---|---|
DOCUMENT_NOT_FOUND | No stored document matches the supplied id. |
INTERNAL_ERROR | The API returned 5xx. Retryable. |
Example
Section titled “Example”# Demonstrates: client.documents.preview(id) — get a stored document's HTML preview.from poli_page import PoliPage
client = PoliPage()
preview = client.documents.preview("doc_abc123")
# `preview.html` is the server-rendered HTML with the stored document's data# applied to its template — useful for in-browser previews without a PDF.print(f"Preview: {preview.page_count} pages, HTML length {len(preview.html)}")