TerraPDF 1.3.0
Prefix Reserveddotnet add package TerraPDF --version 1.3.0
NuGet\Install-Package TerraPDF -Version 1.3.0
<PackageReference Include="TerraPDF" Version="1.3.0" />
<PackageVersion Include="TerraPDF" Version="1.3.0" />
<PackageReference Include="TerraPDF" />
paket add TerraPDF --version 1.3.0
#r "nuget: TerraPDF, 1.3.0"
#:package TerraPDF@1.3.0
#addin nuget:?package=TerraPDF&version=1.3.0
#tool nuget:?package=TerraPDF&version=1.3.0
TerraPDF
A free, pure C# library designed for fast and reliable PDF generation.

π To know more about it and documentation and sample codes. Please visit its website https://terrapdf.com/
New in 1.3.0: Encryption & Password Protection guide β AES-128 encryption, user and owner passwords, fine-grained permission flags, and secure document protection.
TerraPDF is a lightweight, zero-dependency, pure C# library for generating professional PDF 1.7 documents programmatically. It provides a fluent, composable API that covers the full document-authoring lifecycle β from page layout and rich text to tables, images, hyperlinks, and multi-page pagination β with no native binaries, no third-party runtime packages, and no licensing restrictions.
- No native dependencies, no third-party packages
- Targets .NET 8 and .NET 9
- Text styling β bold, italic, bold-italic, strikethrough, underline, font size, colour
- Configurable line-height multiplier per text block
- Per-span formatting inside mixed-style text blocks
- Margin and padding decorators with full unit support
- Background fills and borders (full, rounded, and per-edge)
- Rounded-corner borders and filled rounded boxes
- Per-edge borders β
BorderTop,BorderBottom,BorderLeft,BorderRight - Horizontal and vertical alignment
- Column, Row, and Table layouts
- PNG and JPEG image embedding
- Horizontal and vertical rule lines
- Explicit page breaks via
PageBreak() - Clickable hyperlink (URI) annotations via
Hyperlink() - Internal document links (GoTo) via
InternalLink() - Automatic Table of Contents generation from H1βH6 headings
- PDF bookmarks / outlines with hierarchical nesting
- Document metadata (Title, Author, Subject, Keywords, Creator)
- Conditional rendering via
ShowIf - Reusable components via
IComponent - Headers, footers, and page numbers
- AES-128 PDF encryption β user password, owner password, and fine-grained permission flags (
PdfPermissions) viacontainer.Encrypt() - Full WinAnsiEncoding character coverage
- Vector graphics canvas β lines, rectangles, rounded rectangles, circles, ellipses, arbitrary BΓ©zier paths, polygons, and grid helpers via
container.Canvas() - Fluent, composable API
Installation
dotnet add package TerraPDF
Quick Start
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");
Full Documentation
For complete API reference and detailed guides, visit the docs directory:
- Getting Started β Installation, Quick Start, and basic usage
- Text & Spans β Single-span and multi-span text, styling, page numbers
- Layout β Column, Row, and Table layouts with alignment and spacing
- Row and Column Layout β Detailed Row and Column layout examples
- Decorators β Padding, margin, backgrounds, borders, and styling
- Images β PNG and JPEG embedding with sizing and alignment
- Page Sizes & Units β Built-in page sizes and unit conversions
- Colors β Material Design color palette with shades
- Encryption & Security β AES-128 protection with permission flags
- Vector Graphics β Canvas API, shapes, paths, grids, and charts
- Table of Contents β Automatic TOC generation from headings
- Bookmarks β PDF bookmarks and outlines
- Components & Templates β Reusable components and document templates
- Metadata β Document metadata (Title, Author, Subject, Keywords, Creator)
- Unicode & Character Encoding β WinAnsiEncoding and character coverage
- Samples β Complete working examples demonstrating all features
Building from Source
git clone https://github.com/sahebansari/TerraPDF.git
cd TerraPDF
dotnet build
dotnet test
Requires .NET 8 SDK or later.
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for coding standards, project structure, how to run tests, and the pull-request process.
Changelog
All notable changes are documented in CHANGELOG.md, following the Keep a Changelog format.
Security
To report a vulnerability, please follow the responsible-disclosure process described in SECURITY.md. Do not open a public issue for security problems.
License
MIT β see LICENSE for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.