documents.thumbnails
documents.thumbnails(id: str, options: ThumbnailOptions) -> list[Thumbnail] Generate per-page thumbnails (spec §6.3).
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id | str | required | The `document_id` of the stored document. |
options | ThumbnailOptions | required | Thumbnail options — `width` (required), `format`, `quality`, `pages`. |
Returns
Section titled “Returns”list[Thumbnail] — a list of Thumbnail objects in page order, base64-encoded.
Errors
Section titled “Errors”| Code | When |
|---|---|
DOCUMENT_NOT_FOUND | No stored document matches the supplied id. |
VALIDATION_ERROR | Thumbnail options failed validation. |
INTERNAL_ERROR | The API returned 5xx. Retryable. |
Example
Section titled “Example”# Demonstrates: client.documents.thumbnails(id, options) — page thumbnails for a stored document.from poli_page import PoliPage
client = PoliPage()
thumbnails = client.documents.thumbnails( "doc_abc123", {"width": 840, "format": "png", "pages": [1, 2]},)
# Each entry includes the image bytes base64-encoded.for t in thumbnails: print( f"Page {t.page}: {t.width}x{t.height} {t.content_type} " f"({len(t.data)} base64 chars)" )