Skip to content

render->pdf

render->pdf(PoliPageProjectModeInput $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.

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

string

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.
<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use PoliPage\PoliPage;
use PoliPage\ProjectModeInput;
$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);
$pdf = $client->render->pdf(new ProjectModeInput(
project: 'billing',
template: 'invoice',
data: ['invoiceNumber' => 'INV-001', 'total' => 1280],
));
file_put_contents('./invoice.pdf', $pdf);