Long-term archiving · C# and .NET
Create PDF/A in C#
Generate archival-grade PDF/A from C# with one method call. rust-pdf embeds the sRGB ICC profile, adds the output intent, writes the XMP metadata and document ID, and enforces the rules, so the output validates under veraPDF, the reference validator.
Last updated: 2026-06-29
Why C# and .NET needs this
Archival mandates rarely arrive one file at a time: e-invoice batches, end-of-month statement runs, case-file exports. A BackgroundService or hosted Worker is the natural home: each Document is IDisposable, so a using per file releases the native handle and keeps a long-running queue from leaking. Document.Pdfa(PdfaLevel.A2b), or A2a, A3b, A4, picks the conformance level per job.
PDF/A forbids external dependencies, so every glyph must travel inside the file. AddFontFile embeds and subsets your TrueType or OpenType font automatically, while the core seals in the sRGB ICC profile, the output intent, the XMP packet and a document ID; the a-levels additionally build a tagged structure tree for accessibility. Drop in a font missing a needed codepoint and veraPDF will flag it. The conformance claim is checked, not asserted.
The NuGet package carries the native library and a NativeLibrary.SetDllImportResolver hook finds it under runtimes/<rid>/native, so the same archiving service runs on Windows and inside a dotnet/aspnet:8.0 container. Wire veraPDF into CI against the service's output; PDF/A is a licensed feature, so Save throws a catchable PdfException when the token is absent.
- Levels A-1b, A-2b, A-2a, A-3b, A-3a and A-4 (the PDF 2.0 part), with the accessible a-levels building a full tagged structure tree.
- Fonts embedded and subset automatically, ICC profile and output intent added for you.
- XMP metadata kept in sync with the document info, validated by veraPDF.
Create PDF/A in C# with rust-pdf
Install with NuGet, then call the same idiomatic API every rust-pdf binding shares. The snippet below is real C# code from the reference docs.
dotnet add package RustPdf
using RustPdf;
using var doc = new Document();
doc.Pdfa(PdfaLevel.A2b).SetInfo(title: "Q3 Report", author: "Acme Inc.");
int f = doc.AddFontFile("Roboto-Regular.ttf");
doc.AddPage();
doc.ShowText(f, 20, 72, 760, "Archival report");
doc.Save("report_pdfa.pdf"); // throws PdfException without a license granting PDF/A
C# basic generation is free. PDF/A is a corporate feature, unlocked by one offline license token. See pricing & licensing.
Full C# reference in the documentation.
PDF/A in C#: FAQ
Which PDF/A levels are supported in C#?
rust-pdf creates PDF/A-1b, 2b, 2a, 3b, 3a and 4 (the PDF 2.0-based part, including 4e and 4f). Use a basic b-level for visual fidelity, an a-level for an accessible tagged structure, or a 3-level when you need to embed source files such as an e-invoice XML.
How is conformance verified?
Output is validated with veraPDF, the open-source reference validator for PDF/A, plus qpdf and mutool for structure. The claim is backed by validators, not adjectives.
Do I need a license to create PDF/A in C#?
PDF/A is a corporate feature and requires an active license token. Basic generation in C# is free. One offline token unlocks PDF/A in every supported language.
Which .NET runtimes and operating systems are supported?
rust-pdf targets .NET 8 and later and runs anywhere the native core builds: Windows, Linux and macOS, on x64 or arm64. The NuGet package vendors the matching runtimes/<rid>/native payload and a NativeLibrary.SetDllImportResolver hook locates it, so a Linux container and an arm64 Mac both work with no code changes. Validate the archived output with veraPDF in any of those environments.
Generate compliant archives from your .NET services
One Rust core, the same output across every language. Prototype for free, license the corporate features when you ship.