Skip to content

documents.preview

documents.preview(id: str) -> DocumentPreviewResult

Retrieve stored paginated HTML + page count (spec §6.2).

Name Type Required Description
id str required The `document_id` of the stored document to preview.

DocumentPreviewResult — a DocumentPreviewResult with html and page_count.

Code When
DOCUMENT_NOT_FOUND No stored document matches the supplied id.
INTERNAL_ERROR The API returned 5xx. Retryable.
# 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)}")