Archival & e-invoicing

PDF/A and Factur-X generation for .NET and TypeScript

BonniePDF writes PDF/A-1, PDF/A-2, PDF/A-3, PDF/A-4, and PDF/A-4f documents directly from C# or TypeScript. Font embedding, sRGB output intents, XMP metadata, and file attachment dictionaries are handled by the engine, and every supported profile is checked against a named veraPDF version in CI.

Archival PDF/A from one setting

An archival PDF has to be self-contained: every glyph embedded, colours defined against an ICC output intent, encryption off, and conformance declared in XMP. In BonniePDF you set conformance on the document settings and build the layout as usual.

import { AccessibilityMode, Document, Heading, settings, TextBlock } from '@bonniepdf/core'

settings.license = 'evaluation' // your licence tier, declared once at startup

const doc = new Document({
  settings: {
    conformance: 'pdf/a-2a',               // archival + tagged structure
    accessibility: AccessibilityMode.PdfUa1,
    language: 'en-GB',
  },
  metadata: {
    title: 'Annual Statement 2026',
    author: 'Acme Corp',
  },
})

doc.add(new Heading('Annual Statement', { level: 1 }))
doc.add(new TextBlock('Embedded fonts, sRGB output intent, and XMP metadata are written automatically.'))

const bytes = await doc.generateBytesAsync()

The same levels exist in C# via PdfAConformance; see the .NET PDF/A guide. If a configuration contradicts the standard—such as combining PDF/A with password encryption, or picking an “a” level without tagging—the engine throws or withholds the claim with a diagnostic rather than emitting a broken file.

Factur-X and ZUGFeRD hybrid e-invoices (PDF/A-3)

European B2B e-invoicing workflows based on EN 16931 commonly use a hybrid PDF/A-3 document: a human-readable invoice page with the structured XML invoice attached inside the same file. Calling applyFacturX in TypeScript or FacturX.Apply in C# configures PDF/A-3b, embeds the XML stream as an associated file, and writes the required Factur-X XMP extension schema for Minimum, BasicWL, Basic, En16931, Extended, or XRechnung.

using BonniePDF;
using System.Text;

BonniePdfLicense.Tier = LicenseTier.Evaluation; // your licence tier, declared once at startup

using var doc = new Document(
    new DocumentSettings
    {
        Language = "en-GB",
        Accessibility = AccessibilityMode.PdfUa1,
    },
    new DocumentMetadata
    {
        Title = "Invoice INV-2026-001",
        Author = "Acme Corp",
    });

byte[] xml = Encoding.UTF8.GetBytes("<rsm:CrossIndustryInvoice xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"/>");

// Sets PDF/A-3b, embeds factur-x.xml as an alternative file, and writes the fx: XMP schema
FacturX.Apply(doc, xml, FacturXProfile.En16931);

doc.Add(new Heading("Invoice INV-2026-001") { Level = 1 });
doc.Add(new TextBlock("Hybrid PDF/A-3b invoice with embedded EN 16931 XML."));

byte[] bytes = await doc.GenerateBytesAsync();

BonniePDF packages the PDF/A-3 container and visual invoice; it does not generate or validate your EN 16931 XML payload or tax calculations. See the .NET and TypeScript e-invoicing guides, or walk through the invoice data attachment tutorial.

What the engine handles

Built for long-term retention

Rules enforced at generation time in both .NET and TypeScript.

PDF/A-1 through PDF/A-4f

PDF 1.7 profiles (A-1, A-2, A-3) and PDF 2.0 profiles (A-4 and A-4f with attachments).

Embedded & subsetted fonts

Bundled Liberation faces cover the standard 14 in .NET and Node; custom TrueType and OpenType fonts are subsetted.

Factur-X & ZUGFeRD

One helper attaches EN 16931 XML and writes the PDF/A-3 alternative-file and XMP metadata entries.

Pairs with PDF/UA

Combine PDF/A-2a with PDF/UA-1, or PDF/A-4 and PDF/A-4f with PDF/UA-2 on PDF 2.0.

veraPDF in CI

Test fixtures for every supported profile are checked with veraPDF on each build.

Honest diagnostics

Incompatible settings throw early, and unembedded browser fonts withhold the claim instead of faking it.

Frequently asked questions

Which PDF/A levels does BonniePDF support?

BonniePDF supports PDF/A-1b, PDF/A-1a, PDF/A-2b, PDF/A-2a, PDF/A-2u, PDF/A-3b, PDF/A-3a, PDF/A-3u, PDF/A-4, and PDF/A-4f in both .NET and TypeScript. Use PDF/A-2b for general archiving, PDF/A-2a when you also need a tagged structure tree, PDF/A-3b for Factur-X and ZUGFeRD e-invoices, and PDF/A-4 or PDF/A-4f when targeting PDF 2.0.

Can one file be both PDF/A and PDF/UA?

Yes. Set conformance to PdfA2a (or PdfA1a / PdfA3a) alongside PdfUa1 on PDF 1.7, or pair PdfA4 / PdfA4f with PdfUa2 on PDF 2.0. The engine enforces compatible pairings and writes both declarations into the XMP metadata.

How do fonts work under PDF/A?

PDF/A requires every font in the document to be embedded, including the standard 14 PDF fonts. In .NET and Node.js, BonniePDF substitutes its bundled Liberation fonts (metric-compatible with Helvetica, Times, and Courier) automatically and subsets any TrueType font you register. In the browser, register the font bytes before generating; if an unembedded font reaches the output, the PDF/A claim is withheld and recorded in doc.diagnostics rather than emitted falsely.

Does BonniePDF generate or validate the Factur-X / ZUGFeRD XML?

No. You supply the EN 16931 XML payload. applyFacturX (or FacturX.Apply in C#) switches the document to PDF/A-3b, embeds the XML with the required AFRelationship and MIME type, and writes the Factur-X XMP extension schema. Validate the XML schema, totals, and tax rules in your own billing pipeline.

Why does PDF/A reject encryption?

ISO 19005 forbids encryption on all PDF/A levels so an archived file can still be opened decades later without a password. If you set both conformance and encryption, BonniePDF throws at generation time so the conflict is caught immediately.