Skip to content

render->pdf

render->pdf(PoliPageRenderInput $input): string

Render a PDF and return its raw bytes. Two HTTP calls under the hood: POST /v1/render produces a stored document, then GET presignedPdfUrl fetches the bytes. From the caller’s perspective it’s one operation. The download is bounded as a whole by the timeout ($input->timeout, else the client’s) and is never retried.

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

string

Code When
PROJECT_REQUIRED_FOR_DOCUMENT See [errors](../../../production/errors/) for the full description.
invalid_options See [errors](../../../production/errors/) for the full description.
MISSING_API_KEY See [errors](../../../production/errors/) for the full description.
INVALID_API_KEY See [errors](../../../production/errors/) for the full description.
ORGANIZATION_PURGED See [errors](../../../production/errors/) for the full description.
ORGANIZATION_PAYMENT_GRACE See [errors](../../../production/errors/) for the full description.
ORGANIZATION_CANCELLED See [errors](../../../production/errors/) for the full description.
ORGANIZATION_MIGRATING See [errors](../../../production/errors/) for the full description.
RATE_LIMIT_EXCEEDED See [errors](../../../production/errors/) for the full description.
VALIDATION_ERROR See [errors](../../../production/errors/) for the full description.
RENDER_BODY_TOO_LARGE See [errors](../../../production/errors/) for the full description.
PROJECT_NOT_FOUND See [errors](../../../production/errors/) for the full description.
PROJECT_NOT_IN_ENVIRONMENT See [errors](../../../production/errors/) for the full description.
TEMPLATE_NOT_FOUND See [errors](../../../production/errors/) for the full description.
TEMPLATE_ERROR See [errors](../../../production/errors/) for the full description.
TEMPLATE_UNSAFE See [errors](../../../production/errors/) for the full description.
EMPTY_DOCUMENT See [errors](../../../production/errors/) for the full description.
DOCUMENT_TOO_LARGE See [errors](../../../production/errors/) for the full description.
RENDER_TIMEOUT See [errors](../../../production/errors/) for the full description.
QUOTA_EXCEEDED See [errors](../../../production/errors/) for the full description.
OVERAGE_CAP_EXCEEDED See [errors](../../../production/errors/) for the full description.
PUBLISH_IN_PROGRESS See [errors](../../../production/errors/) for the full description.
STORAGE_ACCESS_DENIED See [errors](../../../production/errors/) for the full description.
INTERNAL_ERROR See [errors](../../../production/errors/) for the full description.
unknown_error 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.
invalid_response See [errors](../../../production/errors/) for the full description.
DOWNLOAD_FAILED See [errors](../../../production/errors/) for the full description.
<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use PoliPage\PoliPage;
use PoliPage\RenderInput;
$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);
$pdf = $client->render->pdf(new RenderInput(
project: 'billing',
template: 'invoice',
data: ['invoiceNumber' => 'INV-001', 'total' => 1280],
));
file_put_contents('./invoice.pdf', $pdf);