Generate and edit PDF documents in your .NET applications using the open-source QuestPDF library and its C# Fluent API. Build invoices, reports and data exports with ease.

www.questpdf.com

Topics
#html #csharp #export #pdf #library #nuget #report #dotnetcore #dotnet #generation #invoice #document #form #generation

MarcinZiabek 1ba01a1cf5 Fixed override value 3 years ago
.github ba409a8712 Create codeql-analysis.yml 3 years ago
QuestPDF 1ba01a1cf5 Fixed override value 3 years ago
QuestPDF.Examples 92abd32aae Updated dependencies 3 years ago
QuestPDF.Previewer 9fc721d66b Fix documentation link for previewer 3 years ago
QuestPDF.Previewer.Examples 539dc83303 Fixed Row.AutoItem width calculation 3 years ago
QuestPDF.ReportSample 6a78a4ebdb Moved document rendering flags to QuestPDF.Settings class 3 years ago
QuestPDF.UnitTests 92abd32aae Updated dependencies 3 years ago
Resources 6e6f884a5f Updated sponsorship section 3 years ago
.editorconfig 846679007f Enable dark mode for previewer and cleanup UI. 3 years ago
.gitignore 8326446446 Library implementation 4 years ago
CODE_OF_CONDUCT.md 6b6d2d7fa3 Create CODE_OF_CONDUCT.md 4 years ago
FUNDING.yml a0909eb057 Create FUNDING.yml 3 years ago
LICENSE 3e3c464974 Initial commit 5 years ago
QuestPDF.sln b80b3414d8 Added http-based previewer 3 years ago
SECURITY.md 20fe49dd01 Update SECURITY.md 4 years ago
global.json f7cd89ccf6 Add global.json 3 years ago
readme.md 6cced3c143 Update readme.md 3 years ago

readme.md


Dotnet GitHub Repo stars Nuget version Nuget download License Sponsor project

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

It offers a layouting 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 layouting engine that is optimized to cover all paging-related requirements.

Please show the value

Choosing a project dependency could be difficult. We need to ensure stability and maintainability of our projects. Surveys show that GitHub stars count play an important factor when assessing library quality.

⭐ Please give this repository a star. It takes seconds and help thousands of developers! ⭐

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!

GitHub Repo stars GitHub Repo stars GitHub Repo stars GitHub Repo stars GitHub Repo stars

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 and want to help the entire community, please consider sponsoring QuestPDF using one of the higher tiers. All developers will see your company logo and the description of your choice. It is a fantastic way to build a strong relationship with the community, show that you care, or even find the best professionals. The truth is, no classical advertisement campaign is as effective as real engagement.

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

Company Description
JetBrains supports this project as part of the OSS Power-Ups program. Thank you!
100$ / month

Sponsor project

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.

// Package Manager
Install-Package QuestPDF

// .NET CLI
dotnet add package QuestPDF

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

Nuget version

Documentation

Getting started tutorial A short and easy to follow tutorial showing how to design an invoice document under 200 lines of code.

API reference A detailed description of behavior of all available components and how to use them with C# Fluent API.

Patterns and Practices Everything that may help you designing great reports and create reusable code that is easy to maintain.

QuestPDF Previewer

The QuestPDF Previewer is a tool designed to simplify and speed up your development lifecycle. First, it shows a preview of your document. But the real magic starts with the hot-reload capability! It observes your code and updates the preview every time you change the implementation. Get real-time results without the need of code recompilation. Save time and enjoy the task!

Learn more

Simplicity is the key

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.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");

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 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.

QuestPDF on JetBrains OSS Power-Ups

QuestPDF was presented on one of the episodes of OSS Power-Ups hosted by JetBrains. Huge thanks for Matthias Koch and entire JetBrains team for giving me a chance to show QuestPDF. You are the best!

<img src="https://github.com/QuestPDF/QuestPDF-Documentation/blob/main/docs/public/jetbrains-oss-powerups-youtube.png?raw=true" width="600px">

YouTube video about QuestPDF