render.preview
render.preview(input: RenderInput): Promise<PreviewResult> Generate paginated HTML preview output. Accepts both project mode and inline mode. Calls POST /v1/render/preview.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
input | RenderInput | required | (no description) |
Returns
Section titled “Returns”Promise<PreviewResult>
Errors
Section titled “Errors”| Code | When |
|---|---|
VALIDATION_ERROR | See [errors](../../../production/errors/) for the full description. |
NOT_FOUND | See [errors](../../../production/errors/) for the full description. |
QUOTA_EXCEEDED | See [errors](../../../production/errors/) for the full description. |
INTERNAL_ERROR | See [errors](../../../production/errors/) for the full description. |
Example
Section titled “Example”// Demonstrates: client.render.preview(input) — accepts project mode OR inline mode.import { PoliPage } from '@poli-page/sdk';
const client = new PoliPage({ apiKey: process.env.POLI_PAGE_API_KEY! });
// Project mode: render the stored template's HTML preview.const preview = await client.render.preview({ project: 'billing', template: 'invoice', data: { invoiceNumber: 'INV-001', total: 1280 },});
console.log(`Preview: ${preview.totalPages} pages, ${preview.environment} env`);console.log(`HTML length: ${preview.html.length}`);