Render modes
The .NET SDK exposes two ways to describe what to render: project mode (a stored template at Project/Template with a Version) and inline mode (raw HTML you pass directly).
Project mode is required by all the PDF-producing methods (Render.PdfAsync, Render.PdfStreamAsync, Render.DocumentAsync, and the RenderToFileAsync helper). Inline mode is supported only by Render.PreviewAsync, which returns paginated HTML rather than PDF bytes — useful for debugging template data without engaging the PDF pipeline.
Project mode
Section titled “Project mode”You reference a template by its Project and Template slugs plus a Version, with a Data payload that fills the template’s placeholders. The compiler enforces this — passing an InlineModeInput to PdfAsync is a compile-time error.
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 }, },});Project mode keeps templates centralised — anyone with dashboard access can edit them without touching code.
Inline mode (preview only)
Section titled “Inline mode (preview only)”For one-off layout experiments, pass the HTML directly via InlineModeInput. It satisfies the sealed RenderInput base type that Render.PreviewAsync accepts:
var preview = await client.Render.PreviewAsync(new InlineModeInput{ Template = "<h1>Hello {{ name }}</h1>", Data = new Dictionary<string, object> { { "name", "World" } },});Inline mode only works with Render.PreviewAsync. To turn inline HTML into a PDF, save it as a template in the dashboard first, then use project mode.
Example
Section titled “Example”using PoliPage;
var client = new PoliPageClient(new PoliPageClientOptions{ ApiKey = Environment.GetEnvironmentVariable("POLI_PAGE_API_KEY")!,});
// Project mode — PDF bytes.byte[] invoicePdf = await client.Render.PdfAsync(new ProjectModeInput{ Project = "billing", Template = "invoice", Version = "1.0.0", Data = new Dictionary<string, object> { { "invoiceNumber", "INV-001" }, { "total", 1280 }, },});
// Inline mode — preview HTML only.var greeting = await client.Render.PreviewAsync(new InlineModeInput{ Template = "<h1>Hello {{ name }}</h1>", Data = new Dictionary<string, object> { { "name", "World" } },});