Free QuestPDF (C# / .NET) Templates & Visual Designer
Uses Google’s Skia 2D graphics engine (SkiaSharp) under the hood to give .NET teams a strongly-typed fluent C# PDF API without headless browsers — generating 1-page PDFs in 4.3 ms and 24 stress-test pages in 214 ms (130.8 MB RAM). Note the $1M revenue Community license threshold.
Install: dotnet add package QuestPDF --version 2026.6.0 | Runtime: .NET (C# (.NET 8/9)) | Version: 2026.6.0 | Popularity: 1.4M/mo installs
Works with: ASP.NET Core, .NET Minimal APIs, Blazor, Azure Functions, WPF
How QuestPDF (C# / .NET) Templates Work in CodePDF
Emits a standalone C# program using QuestPDF's Document.Create() fluent builder, strongly-typed data records, dynamic table/list loops, and precise point-accurate positioning.
- Provides a visual drag-and-drop canvas for QuestPDF without requiring IDE hot-reload companion apps
- Generates clean C# classes ready for ASP.NET Core Minimal APIs (Results.File(bytes, "application/pdf")) and Azure Functions
- Zero Chromium or wkhtmltopdf containers in your .NET Docker images
Quick Start: Generate PDFs with QuestPDF
Install QuestPDF (C# / .NET) (C# (.NET 8/9)), then run the code CodePDF exports for any template:
dotnet add package QuestPDF --version 2026.6.0
- Run dotnet add package QuestPDF --version 2026.6.0 in your .NET project.
- Save the generated file as DocumentGenerator.cs in your project.
- Build with dotnet build, then run the program to produce document.pdf.
- QuestPDF's Canvas container draws with absolute positions and a top-left origin, matching the CodePDF canvas.
- When used in server workloads, QuestPDF runs headless — the library is UI-agnostic by design.
- License check: QuestPDF Community is free only for individuals, non-profits, academia, OSI open-source, and businesses under $1M USD annual gross revenue (excludes publicly traded & government entities). Set LicenseType.Professional or LicenseType.Enterprise if required.
Example QuestPDF Output (Standard B2B Commercial Invoice)
Compiled directly from the Standard B2B Commercial Invoice template (C# (.NET 8/9)):
using System;
using System.Collections.Generic;
using System.Globalization;
using QuestPDF;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;
// This code is generated using codepdf.dev
// Target: QuestPDF 2026.6.0 (dotnet add package QuestPDF --version 2026.6.0)
class Program
{
static string GetString(Dictionary<string, object> data, string key) =>
data.TryGetValue(key, out var value) && value != null ? Convert.ToString(value) ?? "" : "";
static string GetRowValue(Dictionary<string, object> row, string key) =>
row.TryGetValue(key, out var value) && value != null ? Convert.ToString(value) ?? "" : "";
static List<object> GetArray(Dictionary<string, object> data, string key) =>
data.TryGetValue(key, out var value) && value is List<object> list ? list : new List<object>();
static float EstimateTextWidth(string text, float fontSize, bool isBold = false, bool isMono = false)
{
if (string.IsNullOrEmpty(text)) return 0f;
if (isMono) return text.Length * fontSize * 0.62f;
float w = 0f;
foreach (char c in text)
{
// … (1126 more lines in full generated file)
Custom Fonts in QuestPDF
Register .ttf/.otf streams at startup via QuestPDF.Drawing.FontManager.RegisterFont().
- Set CopyToOutputDirectory=PreserveNewest on .ttf files in your .csproj.
- Call FontManager.RegisterFont(File.OpenRead("{{FONT_LOCAL_PATH}}")) before generating documents.
- Apply .FontFamily("{{FONT_FAMILY}}") on DefaultTextStyle or Text spans.
Official documentation: QuestPDF docs
QuestPDF Benchmark Results
Measured on CodePDF’s 26-component, 24-page All-Components Dynamic Multi-Page Flow Stress Test (same document across all 22 libraries).
| Metric | QuestPDF | Rank (of 22) |
|---|---|---|
| Wall-clock time | 214 ms | 12th fastest |
| CPU time | 0.59 s | 10th lowest |
| Peak RAM | 130.8 MB | 14th lowest |
| PDF file size | 403.2 KB | 18th smallest |
- Engine type
- Custom Layout Engine
- Under the hood
- Fluent .NET C# layout engine powered natively by Google Skia (SkiaSharp)
- Runs in
- .NET 8/9 Server & Desktop (ASP.NET Core, Azure Functions — not Blazor WASM)
- Verdict
- Fluent .NET Skia layout engine without Chromium: 214 ms across 24 pages (4.3 ms single-page, 130.8 MB RAM); paid license >=$1M rev.
Under the Hood & Benchmark Highlights
- Powered under the hood by Google’s Skia 2D graphics engine (via SkiaSharp) — delivering crisp typography and native reflow without running a headless browser.
- Generated 11 pages across all 26 components at 282.4 KB PDF and 215.9 MB RAM (3.67s wall-clock includes dotnet run build/startup; 2.34s CPU).
- Watch two constraints: minimal Linux containers need SkiaSharp native runtime libs, and companies ≥$1M USD annual revenue require a commercial license.
Good to Know (QuestPDF Caveats)
- Native SkiaSharp runtime required: QuestPDF relies on native Skia libraries; minimal Linux containers (Alpine/distroless) need the matching SkiaSharp native runtime dependencies installed.
- Commercial license threshold: Not MIT/OSI open source — the free Community license applies only below $1M USD annual gross revenue (and excludes publicly traded companies and government entities). Set QuestPDF.Settings.License accordingly.
- Server/desktop .NET only: Runs headless on .NET servers and desktop apps, not inside Blazor WebAssembly in the browser.
Popular QuestPDF PDF Templates
- Standard B2B Commercial Invoice QuestPDF template — Enterprise commercial tax invoice with QR payment link, Currency balance KPIs, line-item ledger, and ACH wire instructions.
- Corporate Balance Sheet Statement QuestPDF template — Landscape T-account statement of financial position reconciling Assets against Liabilities & Shareholders' Equity.
- Profit & Loss (Income) Statement QuestPDF template — GAAP multi-step income statement tracking revenue, COGS, operating margin KPIs, and net operating profit.
- Purchase Order QuestPDF template — Procurement PO with vendor, ship-to, line items and approval block.
- Certificate of Commercial Liability Insurance QuestPDF template — ACORD-25 style commercial liability certificate verifying CGL, Umbrella, Auto, and Workers' Comp policy numbers and occurrence limits.
- Statement of Work (SOW) QuestPDF template — Project Statement of Work pairing fixed-fee milestone payment tranches with testable UAT acceptance criteria.
All 100 CodePDF templates export to QuestPDF (C# / .NET). Browse them by category: Career (5) · Business (6) · Education (7) · Marketing (6) · Human Resources (8) · Finance (7) · Legal (8) · Healthcare (10) · Logistics (6) · Real Estate (6) · Hospitality (4) · Operations (5) · Technology (5) · Banking (9) · Non-Profit (4) · Personal (3) · Compliance & Enterprise (1), or see the full template gallery.
QuestPDF Template FAQs
Is there a free visual template designer for QuestPDF in C#?
Yes! CodePDF lets you design or customize 100+ templates visually in your browser and export ready-to-compile C# QuestPDF code for .NET 8/9.
How do I return a QuestPDF template from an ASP.NET Core controller?
Call document.GeneratePdf() to obtain a byte[] array (or GeneratePdf(stream)) and return File(pdfBytes, "application/pdf", "invoice.pdf").
Does exported QuestPDF code support dynamic C# collections for tables?
Yes — repeating line items and lists compile into strongly-typed C# collection loops with automatic vertical flow adjustment.
Compare QuestPDF with Other PDF Libraries
QuestPDF is the only .NET engine CodePDF targets. See the full 22-library benchmark rankings · Compare all supported PDF libraries