Get TerraPDF
Free, open-source, and ready to use. Add a pure C# PDF generator to your .NET project in seconds.
đĻ Install via NuGet
The easiest way to get the TerraPDF .NET PDF library is through NuGet.
dotnet add package TerraPDF
Package Information
| Package ID | TerraPDF |
| Latest Version | 2.4.0 (September 27, 2026) |
| Downloads | View on NuGet |
| Target Frameworks | .NET 8, .NET 9, .NET 10 |
| Dependencies | None â zero dependencies |
| License | MIT |
đ Quick Links
GitHub Repository
Source code, issues, pull requests, and community discussions.
đ¨ Build from Source
Prefer to build from source? Clone and compile TerraPDF yourself:
git clone https://github.com/sahebansari/TerraPDF.git
cd TerraPDF
dotnet build
dotnet testRequirements
- .NET 10 SDK (the repository's
global.jsonrequires it for building from source) - Git for cloning the repository
- No other dependencies â TerraPDF is pure C#
CI/CD: TerraPDF uses GitHub Actions for continuous integration and automated NuGet publishing on release tags.
đ Version History
See what's new in each release:
v2.3.0 - September 26, 2026
- Gradient fills:
PathDescriptor.FillLinearGradient(any angle) andFillRadialGradientpaint a two-stop PDF shading clipped to the path, and still combine with an outline, even-odd fill, opacity, and dashes. - Dashes on every stroke: dash patterns and phases on ellipses, rounded rectangles, and pie sectors, plus
PathDescriptor.Dash(...)for any path, and a newPathDescriptor.RoundedRect(...)subpath. - Canvas links, bookmarks, and QR codes:
Link,InternalLink,Bookmark, andQrCodeplace clickable areas, outline entries, and vector QR codes at absolute canvas positions. - Fixes:
VectorCanvas.Grid()now fills the canvas (it drew nothing before), andShowIf(false)now hides the content chained after it. - New Canvas Extras sample, and new sections in the Vector Graphics and Bookmarks guides.
v2.2.0 - September 20, 2026
- Positioned images on the vector canvas â
canvas.Image(...)places a PNG or JPEG in an absolute rectangle from a file path,byte[], orStream, withStretch,Contain,Cover,CoverTopLeft, andCropTopLeftfit modes. Clipping is scoped, so later canvas commands are unaffected. - Elliptical arcs and pie sectors â
PathDescriptor.ArcandSectortake a centre and radii;FillPie,StrokePie, andDrawPietake a bounding box. Angles start at 3 o'clock and increase clockwise. - Dashed strokes and rotated text â dash patterns and phases on canvas lines and stroked rectangles, and an
angleparameter that rotates a text label clockwise around its baseline point. - Fixes â 8-bit grayscale-with-alpha PNGs decode correctly, non-finite arc angles are rejected instead of subdividing forever, and rotated text keeps full-precision matrix coefficients so small angles render exactly.
- New Canvas Media sample, plus expanded Vector Graphics and Images guides.
v2.1.0 - September 3, 2026
- Automatic font subsetting â
FontFamily.Register(...)now embeds only the glyphs a document actually shows instead of the whole font file, with a composite-glyph closure pass so accented Latin letters and Devanagari conjuncts never lose a component glyph. Measured wins: a mixed Latin/Cyrillic/Greek sample dropped 55%, a two-variant Devanagari report dropped 49%. - Constant alpha (
/ExtGState) â everyVectorCanvasfill/stroke primitive takes a trailingopacityparameter, with a matchingPathDescriptor.Opacity(...)setter. Distinct opacity values are deduplicated into shared resources, same as repeated images and fonts. VectorCanvas.Text(text, x, y, ...)â baseline-anchored text on the vector canvas, rendered through a registered custom font or the standard-14 families, plus aMeasureTextWidth(...)helper for centering and right-aligning labels.- No public API removed or changed â existing calls keep behaving exactly as before.
- New Font Subsetting sample, an updated Vector Graphics sample with a rebuilt donut-chart legend, and an expanded Custom Fonts guide.
v2.0.1 - August 28, 2026
- Table column and row spans â
Cell(columnSpan:)no longer overlaps the cell that follows it,Cell(rowSpan:)reserves its columns in the rows below, and a spanned cell is measured so the rows it covers grow to hold its content. - Table pagination â a table with no
HeaderRownow splits across pages, a table placed straight intopage.Content()now paginates, and a page break is never allowed to fall inside a row span. - No public API change â documents that don't use spans and don't overflow a page are byte-for-byte identical to 2.0.0.
- New Table Spans & Pagination sample and an expanded Layout guide.
v2.0.0 - July 23, 2026
- Custom font embedding â
FontFamily.Register(...)embeds a TrueType font (regular/bold/italic/bold-italic) as aType0/CIDFontType2composite font withIdentity-Hencoding, unlocking full Unicode text beyond the standard fonts' WinAnsiEncoding range â brand typefaces, Cyrillic, Greek, and more. - Devanagari-aware rendering (pure C#, no native dependency) â automatic matra reordering, conjunct ligatures (⤏āĨā¤ĩ, ā¤āĨ⤎, ā¤āĨā¤), reph (⤧⤰āĨā¤Ž, ā¤ĩ⤰āĨā¤¤ā¤Žā¤žā¤¨), and below/post-base 'ra' forms (ā¤āĨ⤰, ⤤āĨ⤰, ā¤ĒāĨ⤰, ⤎āĨā¤āĨ⤰) whenever text is drawn through a registered font.
- Word-wrap fix â a single word/token wider than the line now breaks at character boundaries instead of overflowing.
- New
docs/custom-fonts.mdguide and a new Hindi-language report sample.
v1.5.1 - July 10, 2026
- .NET 10 target â the library now multi-targets
net8.0,net9.0, andnet10.0(the current LTS). No API or behaviour changes; existing .NET 8/9 consumers are unaffected. - Test suite now runs once per supported runtime; CI consolidated into a single workflow with the .NET 8/9/10 SDKs.
v1.5.0 - July 9, 2026
- Code128 (Subset B) barcodes via
container.Barcode(data, ...), with optional caption, custom colour, and a configurable quiet zone. - ISO/IEC 18004 QR codes via
container.QrCode(data, ...)â from-scratch generator with automatic version selection (1-40), all four error correction levels, and Reed-Solomon error correction. - Both render as vector-filled rectangles â crisp at any zoom, placeable inside any
Column,Row, orTablecell. - New
PdfPage.AddFilledRectsbatch primitive for efficient rendering of symbols with thousands of modules.
v1.4.0 - July 4, 2026
- AES-256 PDF encryption by default (Revision 6, PDF 2.0), with AES-128 available as a legacy opt-in via
EncryptionOptions.Algorithm. - Images from
byte[]andStreamsources, with format auto-detection, PNG transparency, and deduplication. - Anchor-based bookmarks (
container.Bookmark("Title")) with corrected, zoom-retaining/XYZdestinations. - Paragraphs now split across pages instead of overflowing; decorators repeat correctly on every page.
FontFamily()now actually selects Helvetica, Times, or Courier; multi-spanSpan()callback changed toFunc<TextStyle, TextStyle>.- Flate-compressed, streamed serialization for smaller files and lower peak memory.
v1.3.0 - May 19, 2026
- AES-128 PDF encryption using the PDF Standard Security Handler.
- User and owner passwords for open access and full-access recovery.
PdfPermissionsflags for print, copy, edit, forms, accessibility, assembly, and low-resolution printing.- Encrypted content streams and image XObjects with reliability fixes for trailer IDs, stream filters, and AES padding.
v1.2.3 - Recent graphics and encoding update
- Vector Graphics Canvas API for lines, rectangles, rounded rectangles, circles, ellipses, paths, polygons, grids, and charts.
- WinAnsiEncoding documentation and showcase sample covering Windows-1252 specials and Latin-1 characters.
- Improved sample output for vector graphics and Unicode character coverage.
v1.2.2 â May 4, 2026
- â Table of Contents generation with clickable internal links
- â Internal links (GoTo) with zoom preservation
- â Section headings H1-H6 with default styles
- â Fixed TOC page numbering and heading recorder propagation
v1.2.1 â May 3, 2026
- â Documentation corrections and API updates
- â Fixed color values and added missing shades
- â Improved API method documentation
v1.2.0 â July 14, 2025
- â Underline styling
- â Configurable line-height multiplier
- â Rounded borders and filled rounded boxes
- â Per-edge borders
- â Explicit page breaks
- â Hyperlink URI annotations
- â Fixed per-span style isolation
đ License
TerraPDF is released under the MIT License â a permissive open-source license that allows:
- Commercial use
- Modification and distribution
- Private use
- No warranty (as-is)
Ready to start building?
Add TerraPDF to your project and create amazing PDFs today.