The Principal Dev – Masterclass for Tech Leads

The Principal Dev – Masterclass for Tech Leads28-29 May

Join


Modern PDF library for C# developers

QuestPDF is a production-ready library that lets you design documents the way you design software: with clean, maintainable, strong-typed C# code. Stop fighting with HTML-to-PDF conversion. Build pixel-perfect reports, invoices, and exports using the language and tools you already love.

GitHub Stars and Stargazers
Nuget package download
QuestPDF License



Home Page   •   Quick Start   •   Real-world Invoice Tutorial   •   Features Overview   •   License   •   NuGet



🚀 Quick start

Learn how easy it is to design, implement and generate PDF documents using QuestPDF.
Effortlessly create documents of all types such as invoices and reports.

using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;

// set your license here:
// QuestPDF.Settings.License = LicenseType.Community;

Document.Create(container =>
{
    container.Page(page =>
    {
        page.Size(PageSizes.A4);
        page.Margin(2, Unit.Centimetre);
        page.PageColor(Colors.White);
        page.DefaultTextStyle(x => x.FontSize(20));
        
        page.Header()
            .Text("Hello PDF!")
            .SemiBold().FontSize(36).FontColor(Colors.Blue.Medium);
        
        page.Content()
            .PaddingVertical(1, Unit.Centimetre)
            .Column(x =>
            {
                x.Spacing(20);
                
                x.Item().Text(Placeholders.LoremIpsum());
                x.Item().Image(Placeholders.Image(200, 100));
            });
        
        page.Footer()
            .AlignCenter()
            .Text(x =>
            {
                x.Span("Page ");
                x.CurrentPageNumber();
            });
    });
})
.GeneratePdf("hello.pdf");

The code above produces the following PDF document:

image

Quick Start Tutorial

[!TIP] The library is free for individuals, non-profits, all FOSS projects, and organizations under $1M in annual revenue. Read more about licensing here



Installation

QuestPDF is available as a NuGet package. You can install it through your IDE by searching for phrase QuestPDF. If you are not familiar how to do that, please refer to the following guides:

Or use the following command in your terminal:

dotnet add package QuestPDF


Everything you need to generate PDFs

From layout and styling to production features, QuestPDF gives you the flexibility to create documents of any complexity.

🎨 Visual Content:

🔀 Layout:

📐 Positional:

🛠️ Other:

Explore All QuestPDF Features



Familiar Programming Patterns

Use your existing programming language and patterns to ship faster with less training.

Loops, conditionals, functions are natively supported. Leverage IntelliSense, inspections, navigation, and safe refactoring.

container.Column(column =>
{
    column.Item().Text("Order Items").Bold();

    if (Model.ShowSummary)
        column.Item().Element(ComposeOrderSummary);

    foreach (var item in Model.Items)
        column.Item().Element(c => ComposeItem(c, item));
});

Review document changes like any other code. Get clean diffs, PR approvals, and traceable history.

void ComposeItem(IContainer container, OrderItem item)
{
    container
        .Border(1, Colors.Grey.Darken2)
        .Background(item.HighlightColor)
-       .Padding(12)
+       .Padding(16)
        .Row(row =>
        {
            row.RelativeItem().Text(item.Name);
            row.AutoItem().Text($"{item.Price:F2} USD");
        });
}


Companion App

Accelerate development with live document preview and hot-reload capability. See your changes instantly without recompiling.

Learn about QuestPDF Companion App Learn about QuestPDF Companion App



Enterprise-grade foundations



Perform common PDF operations

Leverage a powerful C# Fluent API to create, customize, and manage your PDF documents with ease.

DocumentOperation
    .LoadFile("input.pdf")
    .TakePages("1-10")
    .MergeFile("appendix.pdf", "1-z") // all pages
    .AddAttachment(new DocumentAttachment
    {
        FilePath = "metadata.xml"
    })
    .Encrypt(new Encryption256Bit
    {
        OwnerPassword = "mypassword",
        AllowPrinting = true,
        AllowContentExtraction = false
    })
    .Save("final-document.pdf");

Learn Document Operation API



Works everywhere you do

Deploy on any major operating system and integrate seamlessly with your favorite IDEs, cloud platforms, and development tools.

Platform Support
Operating Systems Windows, Linux, macOS
Frameworks .NET 6+ and .NET Framework 4.6.2+
Cloud Azure, AWS, Google Cloud, Others
Containers Docker, Kubernetes
IDEs Visual Studio, VS Code, JetBrains Rider, Others


Industry-standard PDF compliance

Generate PDF documents that meet the strictest archival and accessibility requirements. Every build is automatically validated using the open-source veraPDF and Mustang tools.



Fair and Sustainable License

A model that benefits everyone. Commercial licensing provides businesses with legal safety and long-term stability, while funding a feature-complete, unrestricted library for the open-source community.

[!TIP] Free for individuals, non-profits, all FOSS projects, and organizations under $1M in annual revenue.

QuestPDF Pricing QuestPDF License Terms



See a real-world example

Follow our detailed tutorial and see how easy it is to generate a fully functional invoice with fewer than 250 lines of C# code.

Example Invoice

Read Real-world Invoice Tutorial



Community QuestPDF

We are incredibly grateful to our .NET Community for their positive reviews and recommendations of the QuestPDF library. Your support and feedback are invaluable and motivate us to keep improving and expanding this project. Thank you for helping us grow and reach more developers!

Nick Chapsas: The Easiest Way to Create PDFs in .NET

Nick Chapsas The Easiest Way to Create PDFs in .NET

JetBrains: OSS Power-Ups: QuestPDF

JetBrains OSS Power-Ups: QuestPDF



Please help by giving a star ⭐

GitHub stars guide developers toward great tools. If you find this project valuable, please give it a star – it helps the community and takes just a second!

Join libs.tech

...and unlock some superpowers

GitHub

We won't share your data with anyone else.