quest pdf logo

GitHub Repo stars Nuget version Nuget download License Sponsor project

QuestPDF is a modern library that may help you with generating PDF documents in your .NET application by using friendly, discoverable and predictable C# fluent API.

# Introduction

QuestPDF is an open-source .NET library for PDF documents generation.

It offers a layout engine designed with a full paging support in mind. The document consists of many simple elements (e.g. border, background, image, text, padding, table, grid etc.) that are composed together to create more complex structures. This way, as a developer, you can understand the behavior of every element and use them with full confidence. Additionally, the document and all its elements support paging functionality. For example, an element can be moved to the next page (if there is not enough space) or even be split between pages like table's rows.

Unlike other libraries, it does not rely on the HTML-to-PDF conversion which in many cases is not reliable. Instead, it implements its own layout engine that is optimized to cover all paging-related requirements.

# Please share with the community

As an open-source project without funding, I cannot afford advertising QuestPDF in a typical way. Instead, the library relies on community interactions. Please consider sharing a post about QuestPDF and the value it provides. It really does help!

Share on reddit Share on HackerNews Share on twitter Share on facebook Share on linkedin

# Support development

It doesn't matter if you are a professional developer, creating a startup or work for an established company. All of us care about our tools and dependencies, about stability and security, about time and money we can safe, about quality we can offer. Please consider sponsoring QuestPDF to give me an extra motivational push to develop the next great feature.

If you represent a company, want to help the entire community and show that you care, please consider sponsoring QuestPDF using one of the higher tiers. Your company logo will be shown here for all developers, building a strong positive relation.

Sponsor project (opens new window)

Special thanks to all companies that decided to sponsor QuestPDF development. This makes .NET ecosystem a better place for all developers and businesses!

100$ / month

# Installation

The library is available as a nuget package. You can install it as any other nuget package from your IDE, try to search by QuestPDF. You can find package details on this webpage (opens new window).

quest pdf logo (opens new window)

// Package Manager
Install-Package QuestPDF

dotnet add package QuestPDF

// Package reference in .csproj file
<PackageReference Include="QuestPDF" Version="2022.5.0" />

# Quick start

How easy it is to start and prototype with QuestPDF? Really easy thanks to its minimal API! Please analyse the code below:

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

// code in your main method
Document.Create(container =>
    container.Page(page =>
        page.Margin(2, Unit.Centimetre);
        page.DefaultTextStyle(x => x.FontSize(20));
            .Text("Hello PDF!")
            .PaddingVertical(1, Unit.Centimetre)
            .Column(x =>
                x.Item().Image(Placeholders.Image(200, 100));
            .Text(x =>
                x.Span("Page ");

And compare it to the produced PDF file:


# Are you ready for more?

The Fluent API of QuestPDF scales really well. It is easy to create and maintain even most complex documents. Read the Getting started tutorial (opens new window) to learn QuestPDF basics and implement an invoice under 200 lines of code. You can also investigate and play with the code from the example repository (opens new window).