Skip to content

render.pdf

render.pdf(input: ProjectModeInput): Promise<Uint8Array<ArrayBufferLike>>

Render a PDF and return its raw bytes. Two HTTP calls under the hood: POST /v1/render to produce a stored document, then GET presignedPdfUrl to fetch the bytes.

Name Type Required Description
input ProjectModeInput required (no description)

Promise<Uint8Array<ArrayBufferLike>>

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.
timeout See [errors](../../../production/errors/) for the full description.
network_error See [errors](../../../production/errors/) for the full description.
INTERNAL_ERROR See [errors](../../../production/errors/) for the full description.
// Demonstrates: client.render.pdf(input) — project mode only.
import { PoliPage } from '@poli-page/sdk';
const client = new PoliPage({ apiKey: process.env.POLI_PAGE_API_KEY! });
const pdf = await client.render.pdf({
project: 'billing',
template: 'invoice',
data: { invoiceNumber: 'INV-001', total: 1280 },
});
// `pdf` is a Uint8Array of PDF bytes.
console.log(`Rendered ${pdf.byteLength} bytes`);