
A lightweight, zero-dependency, pure C# library for generating professional PDFs. Layout, tables, images, links, bookmarks, vector graphics, WinAnsi text, and AES-128 encryption with no native binaries.
New in TerraPDF 1.3.0
Password-protect documents, restrict actions with permission flags, and build richer graphics-heavy PDFs.
AES-128 PDF Encryption
Protect documents with user and owner passwords, encrypt content streams and image XObjects, and control print, copy, edit, form, accessibility, and assembly permissions.
Vector Graphics Canvas
Draw lines, rectangles, rounded rectangles, circles, ellipses, paths, polygons, grids, charts, and diagrams directly inside TerraPDF layout containers.
WinAnsi Character Coverage
Render Windows-1252 typographic specials and Latin-1 characters with extended AFM width tables for accurate wrapping and measurement.
Encryption Reliability Fixes
Encrypted PDFs now write a stable trailer ID, avoid invalid crypt filters, use correct AES padding, and include broader tests for password and permission combinations.
Why TerraPDF?
Professional PDF generation made simple. Designed for developers who value simplicity, performance, and full control.
Zero Dependencies
Pure C# implementation with no native binaries, no third-party runtime packages, and no licensing restrictions. Just add the NuGet package and you're ready.
Fluent API
Intuitive, composable builder pattern that makes PDF generation feel natural. Chain methods together to create complex layouts with minimal code.
Full Layout Control
Columns, rows, tables, margins, padding, borders, backgrounds, and alignment. Everything you need for professional document layouts.
Image Support
Embed PNG and JPEG images directly into your PDFs with proper sizing and positioning support.
Automatic TOC
Generate a table of contents automatically from your headings (H1-H6) with clickable internal links and proper page numbering.
Hyperlinks & Bookmarks
Support for URI hyperlinks, internal document links, PDF bookmarks, and hierarchical outline navigation.
Document Security
AES-128 PDF encryption with user passwords, owner passwords, and fine-grained permission flags.
Quick Start
Generate your first PDF in under a minute with TerraPDF's simple API.
dotnet add package TerraPDF
Or browse the NuGet package page for all versions.
Hello World Example
using TerraPDF.Core;
using TerraPDF.Helpers;
Document.Create(container =>
{
container.Page(page =>
{
page.Size(PageSize.A4);
page.Margin(2, Unit.Centimetre);
page.PageColor(Color.White);
page.DefaultTextStyle(s => s.FontSize(11));
page.Header()
.Text("My Report")
.Bold()
.FontSize(24)
.FontColor(Color.Blue.Darken2);
page.Content()
.Column(col =>
{
col.Spacing(8);
col.Item().Text("Hello, TerraPDF!");
col.Item().Text("This paragraph is italic.").Italic();
col.Item()
.Margin(6).Background(Color.Grey.Lighten4).Padding(10)
.Text("Indented callout box").Bold();
});
page.Footer()
.AlignCenter()
.Text(t =>
{
t.Span("Page ");
t.CurrentPageNumber().FontSize(9);
t.Span(" / ");
t.TotalPages().FontSize(9);
});
});
})
.PublishPdf("output.pdf");
.NET 8 and .NET 9.
Works with ASP.NET Core, console apps, Windows services, and any .NET application.
Everything You Need to Build Amazing PDFs
A complete toolkit for professional PDF generation in C#. No compromises, no hidden costs.
Typography
Layout
Advanced
Styling
Ready to Get Started?
Generate PDFs in minutes with TerraPDF's simple, zero-dependency API.