render->pdfStream
render->pdfStream(PoliPageProjectModeInput $input): PsrHttpMessageStreamInterface Like but returns the PSR-7 body stream directly so the caller can pipe it to disk or a response without buffering the whole PDF in memory. The caller owns the stream’s lifecycle — close it (or let __destruct close it) when done.
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
$input | \PoliPage\ProjectModeInput | required | (no description) |
Returns
Section titled “Returns”\Psr\Http\Message\StreamInterface
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. |
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. |
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']);
$stream = $client->render->pdfStream(new ProjectModeInput( project: 'billing', template: 'invoice', data: ['invoiceNumber' => 'INV-001', 'total' => 1280],));
$out = fopen('./invoice.pdf', 'wb');try { while (!$stream->eof()) { $chunk = $stream->read(8192); if ($chunk === '') { break; } fwrite($out, $chunk); }} finally { fclose($out); $stream->close();}