Recursive AI

Choosing a C# PDF library

C# PDF libraries compared by license, price and job: OnePDF, PdfPig, PDFsharp, QuestPDF, iText, IronPDF, Aspose.PDF and Syncfusion, with every term sourced.

A C# PDF library is chosen by its license first and its features second. Of the libraries compared here, three are permissively licensed, so their licenses place no copyleft or revenue conditions on closed-source commercial use: OnePDF (MIT OR Apache-2.0), PdfPig (Apache-2.0), and PDFsharp with MigraDoc up to version 6.2.4 (MIT). PDFsharp and MigraDoc 6.5.0 moved to AGPL or a paid commercial license, iText is AGPL or commercial, and QuestPDF is free under its Community License only for eligible users, such as organizations under USD 1 million in annual revenue. IronPDF, Aspose.PDF and Syncfusion are commercial products. After the license, choose by the job: generating documents, reading text, editing existing files, or converting HTML.

Every fact below comes from the publisher’s own license page, pricing page or NuGet listing. Each one is linked, and all were read on 26 October 2026. Licenses change: PDFsharp’s changed in October 2026. Check the current page and the license text before you decide, and take legal questions to a lawyer.

C# PDF libraries at a glance: license and price

Library, version read and licenseClosed-source commercial use, per the publisherPaid option, as publishedNative binaries
OnePDF 1.11.0: MIT OR Apache-2.0Permissive license: no revenue or source-disclosure conditionsNoneNone
PdfPig 0.1.16: Apache-2.0Permissive license: no revenue or source-disclosure conditionsNoneNone
PDFsharp and MigraDoc 6.5.0: AGPL-3.0 or commercial (6.2.4 and earlier: MIT)Needs the commercial license (pricing)€750, perpetual, unlimited developers (B2B, VAT not included)None
QuestPDF 2026.9.1: QuestPDF licenses, source-availableFree under the Community License if eligible, for example under USD 1M annual revenue (guide)Professional $1,999, Enterprise $4,999, plus tax (pricing)Skia and qpdf, 8 runtimes
iText 9.8.0: AGPL-3.0 or commercialAGPL requires disclosing your application’s source, network use included (iText)By quote: OEM, or a subscription priced by PDF volume (how to buy)None
IronPDF 2026.10.3: commercial EULAPaid license; 30-day trialFrom $999, perpetual, 1 developer, 1 location, 1 project (licensing)Chrome, through a package dependency
Aspose.PDF 26.10.0: commercial EULAPaid license; free temporary license to evaluateFrom US$1,199 for 1 developer and 1 location, or metered from US$1,999 a month (pricing)None
Syncfusion 35.1.41: Syncfusion licenseFree under the Community License if eligible, for example under $1M annual revenue and 5 or fewer developers (terms)Not covered here (pricing)None

Licenses are as the NuGet listing of the version named shows them. The native-binaries column comes from listing the files of each published package: OnePDF is one managed DLL (OnePdf.Layout adds a second), and Aspose.PDF is one managed DLL in a 199 MB package. The QuestPDF package carries libQuestPdfSkia and libqpdf under runtimes/ for Linux, macOS and Windows on x64 and Arm. IronPDF depends on the IronPdf.Native.Chrome.Windows package.

What each library is for

OnePDF

One library for the whole life of a PDF: open and repair real-world files, decrypt, extract text in reading order, edit pages, fill and flatten forms, redact, sign and verify signatures, and save as PDF/A or PDF/UA. Its companion package, RecursiveAI.OnePdf.Layout, generates new documents from code. It targets .NET 10 only. More on it below.

PdfPig

“PdfPig supports reading text and content from PDF files. It also supports basic PDF file creation” (README). The same README lists what its document builder does not support: editing forms, copying or changing annotations, metadata or document structure, and adding or removing text with existing fonts. It targets .NET Framework 4.6.2 and 4.7.1, .NET Standard 2.0 and 2.1, and .NET 6, 8 and 9 (NuGet). It is still below 1.0, and the README warns that “minor versions will change the public API without warning”.

PDFsharp and MigraDoc

PDFsharp is “the Open Source library for creating and modifying PDF documents using .NET” (NuGet), and MigraDoc builds on it to lay out documents. Version 6.5.0 is the license break: “Beginning with version 6.5.0, your code must select the type of license to be used”, either PdfSharpLicense.SetAgplLicense() or a commercial key (readme for 6.5, license). Its pricing page puts it plainly: “For using PDFsharp and MigraDoc in closed‑source or differently licensed products, you have to purchase a commercial license.” That license is €750, perpetual, for unlimited developers, projects and deployments, with updates for the 6.5.x and 7.0.x lines. Version 6.2.4 and earlier are still on NuGet under MIT.

What changed in 6.5.0, the license exception and the fix: PDFsharp license.

QuestPDF

A document generator: “a modern PDF generation library for C# and .NET … a code-first alternative to HTML-to-PDF conversion”, which can also merge and edit documents and write PDF/A and PDF/UA (NuGet). The Community License is free for individuals and organizations under USD 1 million in annual gross revenue, qualifying charities, public or non-profit academic institutions, and open-source projects under an OSI-approved license. Public-sector bodies and publicly traded companies aren’t eligible at any revenue (License Selection Guide). Its source is public, but QuestPDF says “your right to use QuestPDF comes from one of our licenses, including the free Community License, not from an OSI-approved open-source license such as MIT” (pricing FAQ). Paid licenses are perpetual with a year of updates, cover unlimited developers, and are priced per legal entity: Professional covers one, and Enterprise adds its affiliates (guide version 3.0, effective 6 July 2026).

iText

iText Core creates, edits and enhances PDF documents (NuGet). The 9.8.0 package includes its forms, PDF/A, PDF/UA and signing assemblies. HTML conversion is the pdfHTML add-on, also AGPL on NuGet. Under the AGPL, iText lists these obligations: disclose the source of your own application, including network deployments; disclose changes to iText; and “retain the producer line in every PDF that is created or manipulated using iText” (AGPLv3 license). Commercial licenses remove those restrictions, and prices are by quote.

Plans, AGPL obligations and what iText publishes about pricing: iText license.

IronPDF

Iron Software describes IronPDF as “Create, read, and edit PDFs. HTML to PDF for .NET” (licensing page). The package depends on a native Chrome package. Licenses count developers, locations and projects, and SaaS or OEM redistribution is an add-on.

Aspose.PDF and Syncfusion

Both are broad commercial PDF libraries: reading, writing and changing documents, with forms (both), and tables, digital signatures and encryption (Syncfusion), according to their NuGet descriptions. Aspose prices per developer and deployment location, or by metered use. Syncfusion includes its PDF library in a suite that is free under its Community License to companies and individuals with under $1 million in annual gross revenue, 5 or fewer developers and 10 or fewer employees, that have never taken more than $3 million in outside capital.

HTML to PDF needs an HTML engine

If your documents start life as HTML and CSS, you need a library with a browser or HTML layout engine inside, such as IronPDF or iText with pdfHTML. A code-first library is a different approach: you describe the document in C#, which skips the browser and its dependencies. OnePDF has no HTML engine. Its document generation is code-first, like QuestPDF and MigraDoc.

OnePDF: read, edit and generate under MIT or Apache-2.0

OnePDF is written in C# with no dependency beyond .NET itself. It has no native binaries and no unsafe code, and it supports NativeAOT and trimming. It was built to be safe on files you didn’t write: limits on decoded size, nesting and object counts are checked before the work they guard, and it never runs a document’s scripts or touches the network. This program generates a page, merges it with an existing PDF (IRS Form W-9) and reads the result back:

Program.csOnePDF 1.11.0 · .NET 10
using OnePdf;
using OnePdf.Layout;
 
// 1. Generate a page from code.
LayoutDocument.Compose(doc =>
{
    doc.Title("Cover letter").Language("en-US");
    doc.Page(page =>
    {
        page.Size(PageSize.Letter);
        page.Margin(72);
        page.Content().Column(col =>
        {
            col.Spacing(12);
            col.Item().Heading(1).Text("New vendor packet").FontSize(22).Bold();
            col.Item().Text("Please complete the attached Form W-9 and return it with your first invoice.");
        });
    });
}).Save("cover.pdf");
 
// 2. Merge it with an existing PDF.
using (PdfDocument cover = PdfDocument.Open("cover.pdf"))
using (PdfDocument form = PdfDocument.Open("fw9.pdf"))
using (PdfDocument packet = PdfDocument.Merge([cover, form]))
{
    packet.SetInfo("Title", "New vendor packet");
    packet.Save("packet.pdf");
}
 
// 3. Read it back, in reading order.
using PdfDocument result = PdfDocument.Open("packet.pdf");
Console.WriteLine($"{result.PageCount} pages, title: {result.Info.Title}");
Console.WriteLine(result.Pages[0].ExtractText().Text);
OutputConsole
7 pages, title: New vendor packet
New vendor packet
 
Please complete the attached Form W-9 and return it with your first invoice.

The packet has the cover page plus the W-9’s six pages, with the W-9’s form fields carried over. The two packages it uses are RecursiveAI.OnePdf and RecursiveAI.OnePdf.Layout, both at 1.11.0. Beyond this sample, the same library covers:

Published benchmarks

The project’s benchmarks compare OnePDF with PdfPig 0.1.16 and OnePdf.Layout with MigraDoc 6.2.4 on the same files. They ran on an AMD Ryzen 9 7950X3D (16 cores) under Linux Mint 22.3 with .NET 10.0.13, and times are BenchmarkDotNet means.

  • Reading, against PdfPig: faster on every task measured (opening files, metadata, full text, and words with positions), from 1.10× to 8.50×.
  • Text quality: on a generated set of 62 files with exact reference text, character error on content was 0.3% for OnePDF, against 5.6% for PdfPig’s layout pipeline and 21.9% for its default Page.Text. On 92 real-world files in 11 categories, it was 5.6% against 13.5% for the better of PdfPig’s two methods.
  • Generation, against MigraDoc: a 50-page report with tables, images and page X of Y took 37.1 ms against 175 ms, and a 10,000-row table took 362 ms against 1,191 ms. Published as NativeAOT, OnePDF’s first invoice in a fresh process takes 4 ms.

What OnePDF doesn’t do

  • HTML to PDF: no HTML engine. Build documents with OnePdf.Layout instead.
  • Rendering: the core library turns a page into drawing calls but doesn’t produce pixels. For PNG or JPEG pages, the separate RecursiveAI.OneImage.Pdf package (MIT OR Apache-2.0) renders them: see convert a PDF to an image in C#.
  • OCR: a scanned page without a text layer gives no text.
  • Older frameworks: it targets net10.0 only, so .NET Framework and .NET 8 projects can’t use it.
  • Some conversions and edge features: no conversion of arbitrary files to PDF/A (files that don’t conform are refused, not rewritten), no XFA form filling, no public-key encryption, and no long-term validation data (PAdES B-LT or B-LTA) when signing.

How to choose a C# PDF library

  • You need a permissive license and more than one job (read, edit, generate) on .NET 10: OnePDF.
  • You only read text, and you target .NET Framework or an older .NET: PdfPig.
  • You already use PDFsharp or MigraDoc: versions up to 6.2.4 are MIT, and 6.5.0 and later need the AGPL or a €750 commercial license. Our PDFsharp migration guide maps the common calls.
  • You generate documents and qualify for QuestPDF’s Community License, or accept its paid tiers: QuestPDF. The QuestPDF migration guide shows the OnePdf.Layout equivalents.
  • Your documents are HTML templates: IronPDF, or iText with pdfHTML.
  • Your project is itself AGPL, or you buy a commercial license: iText, whose add-ons include HTML conversion and OCR.
  • You want a commercial vendor and a support contract: compare the published terms of Aspose.PDF, Syncfusion and IronPDF in the table above.

Common questions

Is there a free C# PDF library for commercial use?

Yes. OnePDF (MIT OR Apache-2.0), PdfPig (Apache-2.0) and PDFsharp/MigraDoc 6.2.4 and earlier (MIT) are permissively licensed. QuestPDF and Syncfusion are free for some users under their community licenses, subject to revenue and other conditions.

Is iText free?

iText is free under the AGPLv3, which iText says requires disclosing the full source code of your own application, including web applications. If you can’t meet those terms, iText sells commercial licenses, priced by quote.

Is PDFsharp still MIT?

Not from 6.5.0. PDFsharp and MigraDoc 6.5.0 and later, and 7.0.0 Preview 2 and later, are AGPL or commercial, and your code has to load one of the two licenses. Version 6.2.4 and earlier were published under MIT.

How do I read a PDF file in C#?

Open it and extract the text. In OnePDF, PdfDocument.Open followed by ExtractText() returns each page’s text in reading order. The full walkthrough is extract text from a PDF in C#.

How do I generate a PDF in C#?

Describe the document in code and save it. With OnePdf.Layout you describe the pages in LayoutDocument.Compose and call Save, as shown in create a PDF in C#.

To start with OnePDF, run dotnet add package RecursiveAI.OnePdf and follow getting started, or browse the cookbook and the OnePDF overview.