MIT Free for personal and commercial use. No licensing fees for private or commercial .NET apps. License

Free, MIT-licensed PDF generation for .NET

Create clean PDFs directly from C#.

TerraPDF is a lightweight, zero-dependency PDF library for invoices, reports, tables, QR codes, barcodes, bookmarks, custom fonts, and encrypted documents.

Zero dependencies Pure C# .NET 8 / 9 / 10 v2.0.1

New release

TerraPDF 2.0.1 fixes table spans and pagination.

Column spans, row spans, header-less tables, and tables placed directly in page content now paginate more predictably.

From C# code to a finished PDF

Write the document in a fluent API. TerraPDF lays it out, paginates it, and writes the file.

PackingSlip.cs Full sample →
var brand = "#1A3C5E";
(string Item, string Sku, int Qty)[] lines =
[
    ("Wireless Mouse - Graphite",   "SKU-10231", 24),
    ("Mechanical Keyboard, 87-key", "SKU-10456", 12),
    ("USB-C Dock, Dual 4K",         "SKU-10877",  6),
    ("Laptop Stand, Aluminium",     "SKU-10920", 18),
];

Document.Create(doc =>
{
    doc.Page(page =>
    {
        page.Size(PageSize.A5);
        page.Margin(1.5, Unit.Centimetre);
        page.DefaultTextStyle(s => s.FontSize(10));

        page.Header().Column(col =>
        {
            col.Item().Row(row =>
            {
                row.RelativeItem().AlignMiddle()
                   .Text("TerraPDF Logistics").Bold().FontSize(13).FontColor(brand);
                row.AutoItem().AlignRight()
                   .Text("PACKING SLIP").Bold().FontSize(20).FontColor(brand);
            });
            col.Item().LineHorizontal(2, brand);
        });

        page.Content().PaddingTop(14).Column(col =>
        {
            col.Spacing(14);

            col.Item().Row(row =>
            {
                row.RelativeItem().Column(shipTo => { /* address block */ });
                row.AutoItem().QrCode("https://terrapdf.example/track/ORD-2026-1187", size: 88);
            });

            col.Item().Table(table =>
            {
                table.ColumnsDefinition(c =>
                {
                    c.RelativeColumn(5);
                    c.RelativeColumn(2);
                    c.RelativeColumn(1);
                });
                // brand header row + line items
            });

            col.Item().AlignCenter()
               .Barcode("ORD-2026-1187", height: 46, showCaption: true);
        });

        page.Footer().AlignCenter().Text(t =>
        {
            t.Span("Page ");
            t.CurrentPageNumber();
            t.Span(" of ");
            t.TotalPages();
        });
    });
})
.PublishPdf("packing-slip.pdf");
The packing slip PDF generated by the code sample: a TerraPDF Logistics header, ship-to address with a QR tracking code, a shaded line-items table, and a Code128 barcode of the order number

No native renderer

Pure C# output with no Chromium, wkhtmltopdf, or runtime deployment surprises.

Document layout

Rows, columns, tables, spans, headers, footers, page numbers, and precise spacing.

Production features

Images, links, bookmarks, metadata, QR codes, barcodes, custom fonts, and AES-256 encryption.

Ready to generate your first PDF?

Start with the guide, then adapt one of the samples for your app.