Enterprise PDF for C# / .NET

The C# PDF library
.NET deserves.

rust-pdf is a C# PDF library that generates archival PDF/A, signs documents with PAdES, encrypts with AES-256 and produces accessible PDF/UA from idiomatic C#. One memory-safe core, the same behavior as every other binding, running entirely on your servers: no per-document SaaS fees, no data leaving your network, no AGPL strings.

Install from NuGet. The native core ships per-runtime, nothing to compile.
dotnet add package RustPdf
Validated by independent tools: veraPDFpdfsigopenssl cmsqpdfmutool

Why .NET teams pick rust-pdf

.NET runs the back office of banks, insurers and the public sector, exactly where PDF/A archival, qualified signatures, AES-256 and PDF/UA are mandatory. Yet the established options are an AGPL library you can't ship without opening your source, a per-server commercial bill, or a SaaS that uploads your documents.

rust-pdf is one dotnet add package with source-generated P/Invoke, a clean Document / EditableDoc API, and a single offline license that unlocks the corporate features. The native core is Send, so each request renders on its own handle with no GC pauses.

  • Native, not headless Chrome: no browser process, no gigabytes of RAM per worker.
  • Runs on your servers: documents never leave your network and nothing phones home, ideal for LGPD/GDPR, fintech and health.
  • No AGPL trap: a commercial per-application license, never the AGPL of iText or the per-server billing of Aspose.
  • Deterministic output: the same input always produces the same bytes, so you can diff and audit it.
  • Free to build with: everyday PDF generation is free forever; you only license the regulated-grade features.

Create your first PDF in C# in five lines

Add the package and you have a working Document. No services to register, no browser to install. Generation is free, forever.

// dotnet add package RustPdf
using RustPdf;

using var doc = new Document();
int font = doc.AddFontFile("Roboto-Regular.ttf");
doc.AddPage();
doc.ShowText(font, 26, 72, 760, "Hello from C#");
doc.Save("hello.pdf");        // done — a valid PDF on disk

Sign PDFs with PAdES B-B · B-LT · B-LTA

A real PKCS#7/CMS detached signature, applied as an incremental update so the original bytes stay byte-for-byte intact. Build up the long-term validation chain one level at a time.

B-B · baseline

The signature itself: hashes the byte range, embeds the CMS with the signing certificate and the ESS signing-certificate-v2 attribute.

B-LT · long-term

Adds a Document Security Store (/DSS) carrying the certificates and CRLs needed to validate the signature years later, offline.

B-LTA · archival

Adds an RFC 3161 document timestamp (/DocTimeStamp) over the DSS, so the whole package can be re-validated after the certificates expire.

using RustPdf;

byte[] pdf  = new Document().AddPage().Save();
byte[] key  = File.ReadAllBytes("signer-key.der");
byte[] cert = File.ReadAllBytes("signer-cert.der");

// B-B: a PAdES baseline signature
byte[] signed = Pdf.Sign(pdf, key, cert, reason: "Approved", pades: true);

// B-LT: embed the validation material, then B-LTA: timestamp it
byte[] lt   = Pdf.AddDss(signed, certs: new[] { cert });
byte[] lta  = Pdf.Timestamp(lt, tsaKey, tsaCert);
File.WriteAllBytes("contract.pdf", lta);

Every signature is verified in CI with pdfsig and openssl cms. Read the full flow on the PAdES page.

Archival PDF/A, levels 1b through 3a

One call switches a document to an ISO 19005 archival profile: an embedded sRGB ICC profile, an output intent, synchronized XMP metadata and a conformance-correct structure. Pick the level your regulator asks for.

LevelProfileUse it when
1bPDF/A-1bLegacy mandates pinned to PDF 1.4 (forces a /CIDSet per font, no object streams).
2bPDF/A-2bThe modern default for visual archival: object streams, JPEG2000, transparency.
2aPDF/A-2aEverything in 2b plus a tagged logical structure, so it doubles as PDF/UA.
3b / 3aPDF/A-3Lets you attach the source file (e.g. the original XML invoice) inside the archive.
using var doc = new Document();
doc.Pdfa(PdfaLevel.A2a)               // archival + tagged in one builder
   .Tagged()
   .SetInfo(title: "Q3 Report");
int f = doc.AddFontFile("Roboto-Regular.ttf");
doc.AddPage();
doc.ShowText(f, 26, 72, 760, "Annual report", headingLevel: 1);
byte[] bytes = doc.ToBytes();         // veraPDF-clean PDF/A-2a

rust-pdf produces and validates 1b, 2b, 2a, 3b, 3a and 4. Read the PDF/A page for what each level guarantees.

Encrypt with AES-256 (R6)

Apply standard security-handler encryption with a user and/or owner password. The file key and IVs come from the OS CSPRNG, so every output is unique. RC4 and AES-128 are there too for legacy readers.

using var ed = EditableDoc.Load(bytes);
ed.Encrypt(owner: "owner-secret", method: Encryption.Aes256);
ed.Save("secured.pdf");               // qpdf-verified AES-256

More on the cipher and key derivation on the AES-256 page.

Accessible, tagged PDF/UA-1

Accessibility here means a real structure tree. rust-pdf builds a nested tree of semantic tags so screen readers and ISO 14289-1 (PDF/UA) validators see a genuine document, not a flat canvas.

  • Headings H1–H6 with a correct reading order and nesting.
  • Figures with /Alt text; decorative art marked as /Artifact.
  • Tables with header scope and cell-to-header associations.
  • Lists (/L · /LI · /LBody) and captions.
  • /Lang, /MarkInfo and DisplayDocTitle set for you.

Validated against PDF/UA-1 with veraPDF. See the PDF/UA page.

No Chromium. No JVM. No AGPL.

The big C# PDF libraries make you choose between a heavyweight browser dependency, an open-source license that forces your code open, or a metered bill. rust-pdf is a single native package with a commercial per-app license.

 rust-pdfIronPDFiText 7QuestPDF
EngineNative Rust coreChromiumJava/.NET.NET (SkiaSharp)
Heavy runtime dependencyNoneChromiumNone
License to ship closed sourceCommercial per-appCommercialAGPL or paidFree <$1M, else paid
Per-document / metered feesNoNoNoNo
Runs fully offlineYesYesYesYes
PDF/A 1b–3a + A-4/4e/4fYesPartialYesNo
PAdES B-B/B-LT/B-LTAYesBasicYesNo
PDF/UA tagged structureYesYesYesNo
Same engine in other languages8 bindings.NET onlyJava/.NET.NET only

Comparison reflects publicly documented behavior at time of writing; verify against each vendor's current docs for your use case.

Free to build with. Licensed when you ship.

Prototype and generate everyday PDFs for free. When you need archival, signatures, encryption or accessibility, one license unlocks them all in .NET and every other binding.

Community free

  • Pages & vector graphics
  • Embedded/subset fonts, Unicode shaping
  • Justified paragraphs & tables
  • Images (JPEG/PNG/alpha/16-bit)
  • Merge / split / rotate
  • Text extraction & optimize

Corporate licensed

  • PDF/A: 1b / 2b / 2a / 3b / 3a archival
  • Digital signatures: PKCS#7, visible & multiple
  • PAdES: B-B / B-LT / B-LTA + RFC 3161 timestamps
  • Encryption: RC4 / AES-128 / AES-256 (R6)
  • Accessibility: Tagged PDF / PDF/UA-1
  • AcroForm: fields with generated appearances
  • Validate & convert: verify signatures, PDF→PDF/A, ZUGFeRD/Factur-X
  • Process: redaction, image extraction, form fill/flatten, page→PNG

Try every licensed feature free for 5 days.

Get a trial token by email and unlock PDF/A, digital signatures, encryption and accessibility in C#. No account, no card required.

One engine. Eight languages. Identical bytes.

The C# package wraps the exact same Rust core as every other binding, so a PDF generated from .NET is byte-identical to one generated from Python or Go. Standardize one document pipeline across your whole stack and license it once.

Start building in .NET

dotnet add package RustPdf and ship your first archival PDF today. Free for everyday generation; license the corporate features when you go to production.

C# PDF library FAQ

Does this C# PDF library do HTML-to-PDF?

No, and that's deliberate. rust-pdf renders PDFs natively from a C# document model instead of driving a headless Chromium browser. That keeps memory use low, output deterministic, and PDF/A and PDF/UA conformance precise, guarantees a browser print path can't make. If your input is HTML, render it server-side first and place the result; if it's structured data, build it directly with the API.

Is the C# PDF library free?

Everyday PDF generation (pages, text, fonts, images, tables, merge and split) is free forever, no license. You only license the corporate features: PDF/A archival, signatures and PAdES, AES-256 encryption and PDF/UA accessibility.

Does it need a browser, JVM or any runtime besides .NET?

No. It's a native Rust core shipped per-runtime inside the NuGet package and called through source-generated P/Invoke. There's no Chromium process, no JVM and nothing to compile, just dotnet add package RustPdf.

Is it AGPL like iTextSharp / iText?

No. rust-pdf uses a commercial per-application license, never the AGPL of iText or the per-server billing of Aspose. You can ship it inside a closed-source product without opening your own source.

Which .NET versions are supported?

rust-pdf targets .NET 8 and later on Linux, macOS and Windows, including server, container and Native AOT deployments. The native core runs in-process on your own infrastructure.

How is the output validated?

Independently: veraPDF (PDF/A 1b–3a + A-4/4e/4f and PDF/UA-1), pdfsig and openssl cms for signatures, and qpdf/mutool for structure, all in CI, not "conformance marketing".