Use this file to discover all available pages before exploring further.
The get_page_screenshot method renders one page of a source file (PDF, image, or Office document) as a base64-encoded PNG. It is the recommended way to display visual previews for citations returned by ask — call it lazily, only when the user actually wants to inspect a citation.
The recommended pattern: call ask, render only the pages the user inspects.
Python
TypeScript
from graphor import Graphorclient = Graphor()response = client.sources.ask( question="What was the revenue in 2025?", file_ids=["file_abc123"],)print(response.answer)# When the user hovers/clicks on a [N] marker, fetch the screenshotdef fetch_citation_image(citation): return client.sources.get_page_screenshot( page_number=citation.page_number, file_id=citation.file_id, max_width=500, # smaller for tooltip/popover )# Example: render only the first cited pageif response.citations: screenshot = fetch_citation_image(response.citations[0]) # screenshot.image_base64 → display in <img src="data:image/png;base64,...">
import Graphor from 'graphor';const client = new Graphor();const response = await client.sources.ask({ question: 'What was the revenue in 2025?', file_ids: ['file_abc123'],});console.log(response.answer);// When the user hovers/clicks on a [N] marker, fetch the screenshotasync function fetchCitationImage(citation: { file_id: string; page_number: number }) { return client.sources.getPageScreenshot(citation.page_number, { file_id: citation.file_id, max_width: 500, // smaller for tooltip/popover });}if (response.citations?.length) { const screenshot = await fetchCitationImage({ file_id: response.citations[0].file_id!, page_number: response.citations[0].page_number!, }); // screenshot.image_base64 → display via `data:image/png;base64,${...}`}
Lazy-load on user interaction — call this method only when the user hovers, clicks, or expands a citation. Most citations are never inspected.
Cache by (file_id, page_number) — the response is deterministic for a given key. Cache the base64 string in memory for the duration of the session to avoid re-rendering.
Pick max_width for the surface you’re rendering — 500 for tooltips/popovers, 900 (default) for inline cards, 1200+ only when the user opens a full preview.
Prefer this over include_citation_images=True in ask — embedding base64 inline bloats the JSON payload by hundreds of KB per cited page and runs all renders synchronously before the answer returns. See When to use include_citation_images.