render.document
render.document(input: ProjectModeInput): Promise<DocumentDescriptor> Render a PDF, store it server-side, and return a flat document descriptor. Like render.pdf but skips the auto-download — caller fetches the PDF via result.downloadPdf() (or stores documentId for later via client.documents.get(id).downloadPdf()).
Calls POST /v1/render. Same wire endpoint as render.pdf — the difference is that pdf chains a second fetch.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
input | ProjectModeInput | required | (no description) |
Returns
Section titled “Returns”Promise<DocumentDescriptor>
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.document(input) — render and store a PDF server-side.import { PoliPage } from '@poli-page/sdk';
const client = new PoliPage({ apiKey: process.env.POLI_PAGE_API_KEY! });
const document = await client.render.document({ project: 'billing', template: 'invoice', data: { invoiceNumber: 'INV-001', total: 1280 }, metadata: { customerId: 'cust_42' },});
// `document.documentId` identifies the stored document — use it with// client.documents.* to fetch, preview, thumbnail, or delete later.console.log(`Stored as ${document.documentId} (${document.pageCount} pages, ${document.sizeBytes} bytes)`);
// Fetch the PDF bytes on demand:const pdf = await document.downloadPdf();console.log(`Downloaded ${pdf.byteLength} bytes`);