# PDF/A

> Save PDF/A-3a from a Windows Forms TextControl with AdobePDFA: EmbeddableFontsOnly, AdaptFont, the rules of the standard and batch archiving of DOCX files.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for Windows Forms > PDF Processing > PDF/A
- **2501 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/pdf-a/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/pdf-a/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/pdf-a/llms-full.txt

---

Contracts, invoices and patient records often have to stay readable for years, on computers that don't exist yet. PDF/A is the PDF format for such archives, and a Windows Forms application writes it by saving with `StreamType.AdobePDFA` instead of `AdobePDF`. The standard sets rules for the document, most of all for its fonts, and your code has to meet them before the save succeeds.

A first PDF/A file is saved in [Create a PDF/A Document](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/pdf/create/#create-a-pdf-a-document), and a PDF/A copy that leaves the editor's settings alone in [Create a PDF/A Copy in the Background](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-processing/save-docx-pdf/#create-a-pdf-a-copy-in-the-background). PDF/A is part of the Enterprise edition, as [Editions and Feature Availability](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/overview/editions/llms-full.txt) lists.

### What PDF/A Is

PDF/A is the ISO standard 19005 for the long-term archiving of electronic documents. A PDF/A file is self-contained: everything needed to display it, such as its fonts, is embedded in the file. Audio, video, JavaScript and other executable content aren't allowed, and neither is encryption.

The standard has several parts. PDF/A-3 allows files of any format to be embedded, such as the XML data of an electronic invoice. The level "a" adds a logical structure with tags, which assistive technologies such as screen readers use, so a PDF/A-3a document is accessible as well as archivable.

### What TX Text Control Writes

- **Since version 34.0,** `StreamType.AdobePDFA` saves PDF/A-3a. The tagged structure is the same one that PDF/UA requires, so one document can conform to PDF/A-3a and PDF/UA at the same time, as [Create an Accessible PDF (PDF/UA)](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/creation-conversion/#create-an-accessible-pdf-pdf-ua) describes.
- **Before version 34.0,** TX Text Control wrote PDF/A-1b, and since version 29.0, documents with attachments as PDF/A-3b.

[StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/streamtype/enumeration/llms-full.txt) `AdobePDFA` can only be used to save, and only a complete document can be saved with it. A PDF/A file is loaded with `StreamType.AdobePDF`, like any other PDF. Whatever the editor shows can be saved as PDF/A: a typed document, a loaded DOCX, RTF or HTML file, a merged template or an imported PDF.

### The Rules of PDF/A

TX Text Control applies the rules of the standard when it saves. These affect your code:

- **Fonts must be embeddable.** [FontSettings.EmbeddableFontsOnly](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/fontsettings/embeddablefontsonly-property/llms-full.txt) must be `true` before a document is saved as PDF/A, and fonts that can't be embedded are replaced. [Embed Fonts in PDF/A](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/fonts/#embed-fonts-in-pdf-a) explains which fonts can be embedded.
- **No passwords.** PDF/A doesn't allow encryption, so a PDF/A document has no user password, master password or access permissions.
- **No JavaScript.** Scripts in [SaveSettings.DocumentLevelJavaScriptActions](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/savesettings/documentleveljavascriptactions-property/llms-full.txt) are left out of PDF/A documents.
- **Pages from the page layout.** The technical article on PDF import and export of the reference sets [ViewMode](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/viewmode-property/llms-full.txt) to `PageView` as the first step for PDF/A, so that the PDF gets the page size of the document. In `FloatingText` mode, the page size and margins are ignored.
- **Attachments are allowed.** PDF/A-3 documents can carry embedded files, as [Attachments](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/attachments/llms-full.txt) describes.

### Save the Editor's Document as PDF/A

The following handler in *Form1.cs* saves the document of `textControl1` as PDF/A and writes every font it replaces to the **Output** window of Visual Studio:

```csharp
private void archiveButton_Click(object sender, EventArgs e)
{
    // Report every font that is replaced
    textControl1.FontSettings.AdaptFontEvent = true;
    textControl1.AdaptFont += TextControl1_AdaptFont;

    // Only fonts that can be embedded; all others are replaced
    textControl1.FontSettings.EmbeddableFontsOnly = true;

    textControl1.ViewMode = ViewMode.PageView;

    try
    {
        textControl1.Save("contract-archive.pdf", StreamType.AdobePDFA,
            new SaveSettings() { DocumentTitle = "Service Contract" });
    }
    finally
    {
        textControl1.AdaptFont -= TextControl1_AdaptFont;
    }
}

private void TextControl1_AdaptFont(object sender, AdaptFontEventArgs e)
{
    Debug.WriteLine(e.FontName + " is replaced with " + e.AdaptedFontName);
}
```

*Form1.cs* needs `using System.Diagnostics;` for `Debug`. The code works as follows:

- [AdaptFont](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/adaptfont-event/llms-full.txt) reports each replaced font, as [Choose the Replacement Fonts](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/fonts/#choose-the-replacement-fonts) describes with its event arguments. The handler is connected before `EmbeddableFontsOnly` is set, because restricting the fonts is one of the moments the event occurs.
- The [SaveSettings](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/savesettings/llms-full.txt) give the archived document a title.

`EmbeddableFontsOnly` stays set after the save, so the user continues with the replaced fonts. When that isn't wanted, create the PDF/A file from a copy in a `ServerTextControl`, as [Create a PDF/A Copy in the Background](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-processing/save-docx-pdf/#create-a-pdf-a-copy-in-the-background) shows.

### Archive a Folder of Documents

A `ServerTextControl` converts documents to PDF/A without the editor. The following handler converts every DOCX file in *C:\\Contracts* and logs the files whose fonts prevent the save; it needs `using System.IO;` as well:

```csharp
private void archiveFolderButton_Click(object sender, EventArgs e)
{
    foreach (string file in Directory.GetFiles(@"C:\Contracts", "*.docx"))
    {
        using (ServerTextControl tx = new ServerTextControl())
        {
            tx.Create();

            // Set before Load, so that it applies to the fonts of the document
            tx.FontSettings.EmbeddableFontsOnly = true;

            tx.Load(file, StreamType.WordprocessingML);

            try
            {
                tx.Save(Path.ChangeExtension(file, ".pdf"), StreamType.AdobePDFA);
            }
            catch (FilterException exception) when
                (exception.Reason == FilterException.FilterError.NonEmbeddableFont)
            {
                Debug.WriteLine(file + " contains a font that can't be embedded.");
            }
        }
    }
}
```

A document that still contains a font that can't be embedded throws a [FilterException](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/filterexception/llms-full.txt) whose [Reason](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/filterexception/reason-property/llms-full.txt) is `NonEmbeddableFont`. [A Document Can't Be Saved as PDF/A](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/troubleshooting/fonts/#a-document-can-t-be-saved-as-pdf-a) lists the messages and fixes.

### Check the Result

Adobe Acrobat shows the standards a PDF claims to conform to. A document saved with `AdobePDFA` in version 34.0 lists PDF/A-3A and PDF/UA-1:

![Adobe Acrobat with a PDF saved by TX Text Control, a note that the file claims PDF/A compliance, and the Standards panel listing PDF/A-3A and PDF/UA-1.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-winforms/pdf-a-conformance.978f21eb.webp)

As the note in the screenshot says, Acrobat opens a PDF/A file read-only to prevent changes, and the panel shows what the file claims, not the result of a validation. To validate PDF/A conformance, use a PDF/A validator such as veraPDF. The `TXTextControl.PDF.Validation` package of Text Control checks PDF/UA, the accessibility part, and only reports whether a PDF/A declaration is present, as [Validate the Accessible PDF](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/creation-conversion/#validate-the-accessible-pdf) describes.

### Electronic Invoices and Signatures

- **Electronic invoices.** ZUGFeRD and Factur-X invoices are PDF/A-3 documents with the invoice data embedded as XML. The Windows Forms sample in [PDF Examples](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/examples/pdf/llms-full.txt) saves such an invoice from the `TextControl`, and [Attachments](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/attachments/llms-full.txt) shows how to embed the XML.
- **Signatures.** [SaveSettings.DigitalSignature](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/savesettings/digitalsignature-property/llms-full.txt) signs a PDF/A document while it is saved, as [Signing PDF Documents](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/digital-signatures/signing/llms-full.txt) describes.

The blog article [PDF/UA vs. PDF/A-3a: Which Format Should You Use for Your Business Application?](https://www.textcontrol.com/blog/2025/10/24/pdf-ua-vs-pdf-a-3a-which-format-should-you-use-for-your-business-application/) compares the two standards.

### Next Steps

- [Font Embedding and Substitution](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/fonts/llms-full.txt): choose the fonts that replace others.
- [Attachments](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/attachments/llms-full.txt): embed XML and other files in PDF/A-3 documents.
- [Digital Signatures](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/digital-signatures/llms-full.txt): sign archived documents.

---

## Nearby

- **Previous:** [PDF Import and Its Limitations](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/import/llms-full.txt)
- **Next:** [Font Embedding and Substitution](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/pdf/fonts/llms-full.txt)
