Skip to content

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.

Name Type Required Description
$input \PoliPage\RenderInput required (no description)

\PoliPage\PreviewResult

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.
<?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;