Skip to content

client.Render.PdfAsync

Task<byte[]> PdfAsync(ProjectModeInput input, RequestOptions? options = null, CancellationToken cancellationToken = default)

Renders a stored project template to a PDF and returns the raw bytes.

Name Type Required Description Default
input ProjectModeInput required The project template reference and optional data.
options RequestOptions? Optional per-call overrides (idempotency key, timeout, extra headers). null
cancellationToken CancellationToken Token to cancel the operation. default

The raw PDF bytes.

Code When
UNAUTHORIZED See [errors](../../../production/errors/) for the full description.
NOT_FOUND See [errors](../../../production/errors/) for the full description.
VALIDATION See [errors](../../../production/errors/) for the full description.
RATE_LIMIT See [errors](../../../production/errors/) for the full description.
TIMEOUT See [errors](../../../production/errors/) for the full description.
NETWORK See [errors](../../../production/errors/) for the full description.
UNKNOWN See [errors](../../../production/errors/) for the full description.
// Demonstrates: client.Render.PdfAsync(input) — project mode only.
using PoliPage;
var client = new PoliPageClient(new PoliPageClientOptions
{
ApiKey = Environment.GetEnvironmentVariable("POLI_PAGE_API_KEY")!,
});
byte[] pdf = await client.Render.PdfAsync(new ProjectModeInput
{
Project = "billing",
Template = "invoice",
Version = "1.0.0",
Data = new Dictionary<string, object>
{
{ "invoiceNumber", "INV-001" },
{ "total", 1280 },
},
});
// `pdf` is a byte[] of PDF bytes.
Console.WriteLine($"Rendered {pdf.Length} bytes");