render->document
render->document(PoliPageRenderInput $input): PoliPageDocumentDescriptor Render a PDF, store it server-side, and return the descriptor with a fresh presigned URL. Same wire endpoint as — the difference is that pdf chains a second fetch for the bytes; document returns immediately so the caller can defer the download (or skip it entirely, e.g. when only the documentId is needed).
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
$input | \PoliPage\RenderInput | required | (no description) |
Returns
Section titled “Returns”\PoliPage\DocumentDescriptor
Errors
Section titled “Errors”| 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. |
Example
Section titled “Example”<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use PoliPage\PoliPage;use PoliPage\RenderInput;
$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);
$doc = $client->render->document(new RenderInput( project: 'billing', template: 'invoice', data: ['invoiceNumber' => 'INV-001', 'total' => 1280],));
echo "stored: {$doc->documentId}\n";echo "presigned URL (15-minute TTL): {$doc->presignedPdfUrl}\n";
$pdf = $doc->downloadPdf();file_put_contents('./invoice.pdf', $pdf);