render->preview
render->preview(PoliPageRenderInput $input): PoliPagePreviewResult Generate paginated HTML preview output for either a stored project + template or raw inline HTML. Calls POST /v1/render/preview.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
$input | \PoliPage\RenderInput | required | (no description) |
Returns
Section titled “Returns”\PoliPage\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”<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use PoliPage\InlineModeInput;use PoliPage\PoliPage;
$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);
$preview = $client->render->preview(new InlineModeInput( template: '<h1>Hello {{ name }}</h1>', data: ['name' => 'World'],));
echo "totalPages: {$preview->totalPages}\n";echo "environment: {$preview->environment}\n";echo $preview->html;