render->document
render->document(PoliPageProjectModeInput $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\ProjectModeInput | required | (no description) |
Returns
Section titled “Returns”\PoliPage\DocumentDescriptor
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\PoliPage;use PoliPage\ProjectModeInput;
$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);
$doc = $client->render->document(new ProjectModeInput( 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);