DRIT.Pdf
26.9.1325
dotnet add package DRIT.Pdf --version 26.9.1325
NuGet\Install-Package DRIT.Pdf -Version 26.9.1325
<PackageReference Include="DRIT.Pdf" Version="26.9.1325" />
<PackageVersion Include="DRIT.Pdf" Version="26.9.1325" />
<PackageReference Include="DRIT.Pdf" />
paket add DRIT.Pdf --version 26.9.1325
#r "nuget: DRIT.Pdf, 26.9.1325"
#:package DRIT.Pdf@26.9.1325
#addin nuget:?package=DRIT.Pdf&version=26.9.1325
#tool nuget:?package=DRIT.Pdf&version=26.9.1325
DRIT.Pdf
Pure-Managed .NET PDF Document Library
Create, Read, Manipulate, Sign, and Convert PDF Documents
DRIT.Pdf is a pure-managed, cross-platform .NET library for creating, reading, and manipulating PDF documents — PDF with full support for AcroForms, digital signatures (PKCS#12, PKCS#11, PAdES), encryption, a complete annotation hierarchy, tagged PDFs and PDF/UA, PDF/A & PDF/X conformance, portfolios, and document comparison — without relying on any external software dependencies.
Key Benefits
- Pure managed C# implementation with minimal NuGet dependencies
- Consistent rendering results across Windows, Linux, macOS
- Seamless migration path from GemBox.Pdf and Aspose.PDF
- Full annotation hierarchy, AcroForm model, and tagged-PDF structure tree
- PDF/A-1b/2u/3b and PDF/X-4 conformance writing
- Integrated with DRIT.Drawing for advanced graphics and font support
Cross-Platform PDF Library
DRIT.Pdf targets .NET Framework 4.8, .NET 6.0, and .NET 8.0, so it runs on:
- Operating Systems: Windows, Linux, macOS
- Frameworks: .NET Framework 4.8, .NET 6.0, .NET 8.0
- Dependencies: DRIT.Drawing; System.Security.Cryptography.Pkcs (.NET 6.0+); System.Memory (.NET Framework 4.8)
Features
Document I/O
- Create — generate new PDF documents from scratch
- Load/Save — read from and write to file or stream, with load options (password)
- Merge & Split —
Pages.AddClonefor document merging and page extraction - Incremental Update — lightweight
SaveOptions.Incrementaledits without rewriting the file
Pages
- Page tree operations with inherited MediaBox/Rotate
- Page size, rotation, and boundary boxes (Media, Crop, Bleed, Trim, Art)
- Page layout (
PageLayout) and page mode (PageMode) - Viewer preferences (hide toolbar, fit window, direction, …)
Content & Drawing
FormattedTextwith font family, size, weight, style, color, and max text widthPathContent— lines, Bezier curves, rectangles, stroke/fill, dash patternsPdfImageplacement (JPEG, PNG, BMP, TIFF, GIF via DRIT.Drawing)TableDOM with rows, columns, borders, and cell content- Color spaces (DeviceGray/RGB/CMYK, CalGray/RGB, Lab, ICCBased, Indexed, Separation, DeviceN)
- Patterns (tiling, shading) and shadings (axial, radial, free-form/lattice mesh, Coons/tensor patch)
Text Operations
- Text extraction (full document, per page, by region)
- Text search (string and regular expression)
- Text replace (global, per page, first occurrence, regex)
- Text redaction
Annotations
Full annotation hierarchy rooted at Annotation → MarkupAnnotation:
- Link, line, polyline, polygon
- Text markup (highlight, underline, squiggly, strike-out)
- Sticky note, stamp, free text
- Square, circle, ink, caret
- Redaction, file attachment, popup
- Annotation flags, border style, appearance streams, and flatten
Actions
First-class action hierarchy:
GoToAction,GoToRemoteAction,LaunchAction,UriAction,JavaScriptActionActionCollectionon links, form fields, and document open-action
Forms (AcroForm)
- All field types: text, check box, radio button, dropdown, list box, button, toggle button, signature
- Fill, read, and flatten forms
- FDF/XFDF import/export
- Form actions (reset, submit, import/export data)
- XFA storage
Security & Signatures
- Encryption — AES-256, AES-128, RC4 with user/owner passwords and permissions
- Digital signatures — PKCS#12 (PFX) and PKCS#11 (hardware token)
- PAdES — B-B level, DSS dictionary, LTV support
- Signature validation — hash integrity and certificate chain
- Signature workflows — author permission, locked fields, timestamp
Outlines & Navigation
- Bookmark/outline collection with nested items and destinations
- Hyperlinks (internal page, external URI, file launch)
- Table of contents
Tagged PDF & Accessibility
TaggedContentstructure tree withStructureElement- Table, row, header, cell, paragraph, note structure elements
- PDF/UA support
Conformance
- PDF/A-1b, PDF/A-2u, PDF/A-3b writing via
SaveOptions.Conformance - PDF/X-4 writing
Attachments
- Embedded files (from file/stream with metadata)
- File attachment annotations (icons, description)
- Associated files (
/AFrelationships) - Portfolios (folder/field hierarchy, sort levels, collection layout)
Metadata
- Document info (title, author, subject, keywords)
- XMP metadata read/write
Additional Capabilities
- Document comparison (
DocumentComparerwith difference hierarchy) - Optional content groups (layers)
- Marked content (tag roles, ActualText)
- Advanced low-level escape hatch (
ObjectDictionary)
Supported File Formats
| Format | Description | Read | Write |
|---|---|---|---|
| Portable Document Format | ✔️ | ✔️ | |
| PDF/A | Archival PDF (A-1b/2u/3b) | ✔️ | ✔️ |
| PDF/X-4 | Printing PDF | — | ✔️ |
| FDF | Forms Data Format | ✔️ | ✔️ |
| XFDF | XML Forms Data Format | ✔️ | ✔️ |
| JPEG | JPEG Image | ✔️ | ✔️ |
| PNG | PNG Image | ✔️ | ✔️ |
| TIFF | TIFF Image | ✔️ | ✔️ |
| BMP | Bitmap Image | ✔️ | — |
| GIF | GIF Image | ✔️ | — |
Image export (PDF → JPEG/PNG/TIFF) and printing are provided by the separate DRIT.Pdf.Rendering package (.NET 8.0 only).
Installation
1. Install via NuGet
- Open Microsoft Visual Studio and the NuGet package manager
- Search for "DRIT.Pdf"
- Click Install to download and reference it in your project
2. Install via Package Manager Console
Install-Package DRIT.Pdf
3. Install via .NET CLI
dotnet add package DRIT.Pdf
Code Examples
Create a PDF Document
using DRIT.Pdf;
using DRIT.Pdf.Content;
// Initialize a new PDF document
using var document = new Document();
// Add a page to the document
var page = document.Pages.Add();
// Add a title
using var title = new FormattedText();
title.FontFamily = PdfFontFamily.TimesRoman;
title.FontSize = 24;
title.FontWeight = PdfFontWeight.Bold;
title.Append("Annual Research Report 2025");
page.Content.DrawText(title, new PdfPoint(72, page.Height - 100));
// Save the document
document.Save("output.pdf");
Merge PDF Documents
using DRIT.Pdf;
// Merge multiple documents into one
using var merged = new Document();
foreach (var path in new[] { "chapter1.pdf", "chapter2.pdf", "chapter3.pdf" })
{
using var source = Document.Load(path);
merged.Pages.AddClone(source.Pages);
}
merged.Save("merged.pdf");
// Split: extract each page into a separate document
using var toSplit = Document.Load("merged.pdf");
for (int i = 0; i < toSplit.Pages.Count; i++)
{
using var single = new Document();
single.Pages.AddClone(toSplit.Pages[i]);
single.Save($"page_{i + 1}.pdf");
}
Fill a PDF Form
using DRIT.Pdf;
using DRIT.Pdf.Forms;
// Load PDF with form
using var document = Document.Load("form.pdf");
// Fill a text field by name
document.Form["ParticipantName"].Value = "Sofía Guerrero";
// Tick a check box
var consent = (CheckBoxField)document.Form["ConsentGiven"]!;
consent.IsChecked = true;
// Select a dropdown value
document.Form["Cohort"].Value = "June 2026";
// Save filled document
document.Save("filled.pdf");
Add a Digital Signature
using DRIT.Pdf;
using DRIT.Pdf.Content;
using DRIT.Pdf.Security;
using var document = new Document();
var page = document.Pages.Add();
// Add a visible signature field
var sigField = document.Form.Fields.AddSignature(page, 72, 100, 300, 80);
sigField.Name = "InstructorSignature";
sigField.Appearance.Reason = "Certified by Dr. Petra Holmann";
sigField.Appearance.Location = "TechPath Academy, Berlin";
// Sign with a PFX certificate (PAdES B-B)
var digitalId = new DigitalId("certificate.pfx", "password");
var signer = new Signer(digitalId) { PadesMode = true };
sigField.Sign(signer);
document.Save("signed.pdf");
Encrypt a PDF
using DRIT.Pdf;
using DRIT.Pdf.IO;
using DRIT.Pdf.Security;
using var document = new Document();
document.Pages.Add();
var encryption = new PasswordEncryption
{
DocumentOpenPassword = "open-password",
PermissionsPassword = "owner-password",
Permissions = UserAccessPermissions.PrintHighResolution | UserAccessPermissions.FillForm,
EncryptionLevel = EncryptionLevel.Aes256
};
document.SaveOptions.Encryption = encryption;
document.Save("encrypted.pdf");
// Open with the correct password
var loaded = Document.Load("encrypted.pdf", new LoadOptions { Password = "open-password" });
Convert PDF to Images
using DRIT.Pdf;
using DRIT.Pdf.IO;
using DRIT.Pdf.Rendering;
using var document = Document.Load("input.pdf");
// Single-page PNG
document.Save("page1.png",
new ImageSaveOptions(ImageSaveFormat.Png)
{
PageNumber = 0,
PageCount = 1,
Width = 1200,
Dpi = 150
});
// Single-page JPEG
document.Save("page1.jpg",
new ImageSaveOptions(ImageSaveFormat.Jpeg)
{
PageNumber = 0,
PageCount = 1,
Width = 1200,
JpegQuality = 90
});
System Requirements
- Target Frameworks: .NET Framework 4.8, .NET 6.0, .NET 8.0
- Dependencies: DRIT.Drawing; System.Security.Cryptography.Pkcs (.NET 6.0+); System.Memory (.NET Framework 4.8)
- Optional: DRIT.Pdf.Rendering for image export and printing (.NET 8.0 only)
Documentation
- DRIT.Pdf product page
- Runnable code examples — 40+ standalone console projects
- API Reference (coming soon)
© 2021-2026 DR-IT Ltd. All Rights Reserved.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
| .NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- DRIT.Drawing (>= 26.7.0)
- System.Memory (>= 4.5.5)
-
net6.0
- DRIT.Drawing (>= 26.7.0)
- System.Security.Cryptography.Pkcs (>= 8.0.0)
- System.Security.Cryptography.Xml (>= 8.0.1)
-
net8.0
- DRIT.Drawing (>= 26.7.0)
- System.Security.Cryptography.Pkcs (>= 8.0.0)
- System.Security.Cryptography.Xml (>= 8.0.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on DRIT.Pdf:
| Package | Downloads |
|---|---|
|
DRIT.Spreadsheet
DRIT.Spreadsheet is a pure-managed, cross-platform .NET library for creating, reading, and manipulating spreadsheet documents (XLSX, XLS, XLSB, CSV, TSV). It offers comprehensive spreadsheet capabilities including a formula calculation engine, charts, pivot tables, tables, conditional formatting, data validation, digital signatures (PKCS#12, XAdES-BES), AES-256 encryption, form controls, VBA macros, and PDF export — built on a clean-room implementation with minimal NuGet dependencies. |
|
|
DRIT.Presentation
DRIT.Presentation is a pure-managed, cross-platform .NET library for creating, reading, and manipulating PowerPoint presentations (PPTX, PPTM, PPSX, PPSM, and ODP). It offers presentation processing capabilities including slides, charts, SmartArt, shapes, animations, transitions, media, digital signatures, AES-256 encryption, VBA macros, and PDF, image, SVG, and HTML export. |
|
|
DRIT.Document
DRIT.Document is a pure-managed, cross-platform .NET library for creating, reading, and manipulating Word documents (DOCX, legacy DOC, and ODT). It offers comprehensive document processing capabilities including text formatting, tables, headers/footers, mail merge, and document conversion. |
|
|
DRIT.Barcode
DRIT.Barcode is a pure-managed, cross-platform .NET library for generating and recognizing barcodes across 60+ symbologies, including 1D, 2D, GS1 DataBar, postal, and complex barcodes. It provides raster and true vector SVG/EMF output through DRIT.Drawing and PDF output through DRIT.Pdf. |
GitHub repositories
This package is not used by any popular GitHub repositories.
- Added clipped image drawing and improved legacy Symbol, Wingdings, and Webdings glyph mapping.
- Made content-stream compression configurable; output is uncompressed by default unless enabled through SaveOptions.CompressContentStreams.
- Corrected the XML signature dependency for reliable license verification on .NET 6 and .NET 8.