SoftZenPdf 1.1.0
dotnet add package SoftZenPdf --version 1.1.0
NuGet\Install-Package SoftZenPdf -Version 1.1.0
<PackageReference Include="SoftZenPdf" Version="1.1.0" />
<PackageVersion Include="SoftZenPdf" Version="1.1.0" />
<PackageReference Include="SoftZenPdf" />
paket add SoftZenPdf --version 1.1.0
#r "nuget: SoftZenPdf, 1.1.0"
#:package SoftZenPdf@1.1.0
#addin nuget:?package=SoftZenPdf&version=1.1.0
#tool nuget:?package=SoftZenPdf&version=1.1.0
SoftZenPdf
A PDF library for .NET, built from the PDF specification (ISO 32000) up, with no dependencies beyond .NET itself.
Create documents with text, graphics, fonts and images; convert HTML, images and scans to PDF; read, merge, split, encrypt and fill existing PDFs; extract text; and produce PDF/A-2b archives.
dotnet add package SoftZenPdf
Requires .NET 8 or later. No native binaries, no other NuGet packages.
Create a PDF
using SoftZenPdf;
var document = new PdfDocument();
var page = document.AddPage(PageSize.A4);
page.Content
.DrawText("Hello, SoftZenPdf", 72, 770, StandardFont.Helvetica, 24)
.DrawRectangle(72, 560, 200, 120, fill: PdfColor.FromHex("#3B82F6"));
document.Save("hello.pdf"); // or document.ToArray(), or document.Save(stream)
Coordinates are in points (1/72 inch) from the bottom-left corner of the page.
Convert HTML to PDF
SoftZenPdf has its own HTML parser, CSS engine and layout engine, so no browser is involved:
using SoftZenPdf.Html;
var converter = new HtmlConverter(new HtmlConverterOptions { BaseDirectory = "templates" });
converter.Convert(File.ReadAllText("templates/invoice.html")).Save("invoice.pdf");
It supports style sheets with the CSS cascade, @page and @font-face, text styling, lists, tables with repeated
header rows, images, links and bookmarks. JavaScript, flexbox, grid, floats and positioning are not supported.
Lay out flowing documents
using SoftZenPdf.Layout;
var flow = new FlowDocument();
flow.Add(new Paragraph("Quarterly report", new TextStyle { FontSize = 20, Bold = true }) { OutlineLevel = 1 });
flow.Add(new Paragraph("Text wraps and continues on as many pages as it needs..."));
var table = new Table { CellBorders = Borders.All(BorderLine.Thin) };
table.AddRow("Region", "Revenue").IsHeader = true;
table.AddRow("North", "1,200");
flow.Add(table);
flow.ToPdf().Save("report.pdf");
Paragraphs wrap and justify, tables continue across pages with their header rows, and headers, footers and page
numbers are added to every page. A FontProvider finds fonts by family name, including the fonts installed on the
computer, and falls back to other fonts for characters the chosen one lacks.
Fonts, text and images
- The 14 standard PDF fonts, and TrueType fonts (
.ttf,.ttc) embedded as subsets, with kerning, ligatures, right-to-left text (Hebrew, Arabic with joined letters) and the Unicode Bidirectional Algorithm. - JPEG, PNG, GIF, BMP and TIFF images (including multi-page and fax TIFFs);
PdfDocument.FromImagesturns images and scans into pages.
Work with existing PDFs
var reader = PdfReader.Open("report.pdf"); // or PdfReader.FromBytes / FromStream
string text = reader.ExtractText(0);
PdfDocument.Merge(reader, PdfReader.Open("appendix.pdf")).Save("merged.pdf");
var filler = PdfFormFiller.Open("form.pdf");
filler.SetValue("Name", "Jane Doe");
filler.Save("filled.pdf");
- Merge, split, reorder and rotate pages; bookmarks, links, metadata and watermarks.
- Encryption with AES-256 (the default), AES-128 or RC4, with permissions; opening encrypted files.
- Interactive forms: create text fields, check boxes, radio buttons, dropdowns, list boxes and buttons, and fill existing forms.
- Text extraction as plain text or positioned runs.
- PDF/A-2b creation, with a built-in validator.
OCR and searchable PDFs
Recognising the text in scans is a separate add-on, so this package keeps no dependencies:
dotnet add package SoftZenPdf.Ocr
It uses Tesseract 5 to read words with their positions, turn scanned images into searchable PDFs and PDF/A-2b, and add a text layer to existing scanned PDFs. See https://pdf.softzensystems.com/docs/guides/ocr.
Redaction
Removing sensitive information for good is another add-on:
dotnet add package SoftZenPdf.Redact
It finds text with regular expressions or takes areas you mark, and removes the text, shapes and image pixels underneath from the page content, along with matching metadata, notes and form values. See https://pdf.softzensystems.com/docs/guides/redaction.
Optimizing file size
Making files smaller is a third add-on:
dotnet add package SoftZenPdf.Optimizer
It recompresses streams and images, removes duplicate fonts and resources, downsamples images to a target resolution and converts CMYK images to RGB, replacing each object only when the result is smaller, and can linearize files for fast web view. See https://pdf.softzensystems.com/docs/guides/optimization.
Limitations
Word (.docx) conversion, digital signatures, rendering PDF pages to images, CFF (PostScript-outline) OpenType fonts and Indic script shaping are not supported yet. The documentation lists every known limitation.
License
SoftZenPdf is commercial software, licensed under the SoftZenPdf License Agreement (the LICENSE file in the package).
- Community license (free) for individuals and for organisations with annual revenue under US$1 million.
- Professional (per developer) and Enterprise (unlimited developers) licenses for everyone else. Both include a year of updates, and you can keep using the versions released in that year forever.
- Your applications can be deployed to any number of servers and end users, royalty-free.
Without a license key, SoftZenPdf runs in evaluation mode: everything works, but each saved page carries a small
"evaluation copy" banner. Add your key once at startup, or set the SOFTZENPDF_LICENSE_KEY environment variable:
PdfLicense.SetKey("SZP1...."); // keys are checked offline
Console.WriteLine(PdfLicense.Status); // "Licensed to Acme Ltd (Professional, 3 developers, ...)"
Questions, licensing and bug reports: info@softzensystems.com.
The package also contains third-party data under its own terms, in the licenses folder of the package: Adobe Core
14 font metrics (Adobe), the Adobe Glyph List (BSD-3-Clause), the ICC sRGB profile (ICC), and Unicode character data
(Unicode License v3).
🌐 Official Website
Visit pdf.softzensystems.com for more information, features, and updates.
| 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 was computed. 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.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on SoftZenPdf:
| Package | Downloads |
|---|---|
|
SoftZenPdf.Ocr
OCR for SoftZenPdf with Tesseract 5: recognise text in scanned images and PDFs with word positions and confidence, turn scans into searchable PDFs and PDF/A-2b, and make existing scanned PDFs searchable. |
|
|
SoftZenPdf.Optimizer
PDF size optimization for SoftZenPdf with fine-grained control: recompress streams, remove unused and duplicate objects and fonts, recompress, convert and resize images, and convert CMYK images to RGB, keeping whichever version of each object is smaller. |
|
|
SoftZenPdf.Redact
Secure redaction for SoftZenPdf: find text with regular expressions or mark areas, and remove what lies underneath from the PDF itself: text, vector graphics and image pixels, plus matching metadata, bookmarks, annotations and form values. Nothing removed can be recovered from the output. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Internal support for the new SoftZenPdf.Ocr, SoftZenPdf.Redact and SoftZenPdf.Optimizer add-ons: an embedded font for invisible text, a content-stream interpreter and editor, a JPEG decoder and encoder, and rewriting existing files with object streams, linearization and encryption kept. No public API changes. Full notes: https://pdf.softzensystems.com/changelog