How to Export PDF/A, PDF/A-3, or PDF/A-4 Format Documents in C#
您的企业在 PDF 安全性和合规性方面的年度订阅费用过高。请考虑IronSecureDoc,它为管理数字签名、节录、加密和保护等 SaaS 服务提供解决方案,只需一次性支付。探索 IronSecureDoc 的文档。
IronPDF支持按照 PDF/A-3b 和 PDF/A-4 标准导出 PDF。 PDF/A-3B 是一种严格的 ISO PDF 规范子集,用于创建文档的存档版本,旨在使其始终如保存时那样精确呈现。 PDF/A-4 是最新的合规标准,提供了对数字签名的增强支持。
第 508 节合规性
IronPDF 遵循谷歌的倡议,提高 PDF 的归档和可访问性,以符合第 508 条的规定。 在使用 HTML 转换为 PDF 时,我们的渲染引擎会保留所有无障碍功能。
2021 年,我们转而使用 Google Chromium 的 HTML 渲染引擎从 HTML 渲染 PDF。这使得我们的软件可以继承谷歌已经实现的可访问性工作。
为什么符合第 508 条对于 PDF/A 文档很重要?
第 508 条合规性确保使用屏幕阅读器等辅助技术的残障人士可以访问 PDF 文档。 符合第 508 条标准的 PDF/A 文档可确保内容在存档期间保持可访问性。 对于政府机构、教育机构以及为所有用户提供平等信息获取途径的组织而言,这一合规性至关重要。
最小工作流程(4 个步骤)

- Download C# Library for Creating PDF/A Documents
- 加载现有 PDF 或从 HTML/URL 呈现
- 根据存档要求选择 PDF/A 版本
- 转换并保存为符合 PDF/A 标准的文档
IronPDF 支持哪些 PDF/A 版本?
IronPDF 支持一致性级别 A 和 B。 "A"代表"可访问","B"代表"基本"。这些级别适用于 PDF/A-1、PDF/A-2 和 PDF/A-3 标准。 以下信息来自 Adobe 的 PDF/A 文档。 默认情况下,通过 IronPDF 生成的 PDF 输出为 PDF/A-3B (ISO 19005-3)。
- A级一致性符合所有规范要求,允许辅助软件提高身体受损用户的可访问性。
- 级别 B的一致性较低,合规性极低,侧重于长期保持视觉外观。
PDF/A-1、PDF/A-2 和 PDF/A-3 之间有哪些区别?
PDF/A-1: 基于原始 PDF 1.4 版本。
**PDF/A-2:**于 2011 年 7 月作为 ISO 32001-1 发布,包括 PDF 1.7 以前版本的所有功能以及新功能。 支持扫描文件的 JPEG2000 和定制 XMP 元数据的特定要求。 在处理 PDF 元数据时,IronPDF 可确保正确处理 XMP 元数据。
PDF/A-3: 包括所有 2 级要求。 允许将其他文件格式--XML、CSV 和文字处理格式--嵌入到符合 PDF/A 标准的文档中。
PDF/A-4: PDF/A 合规性标准的最新版本,于 2020 年发布。它以 PDF 2.0 为基础,引入了改进的功能,包括与 PDF/A-3 相比增强了对数字签名的支持。该版本最适合涉及三维模型和其他复杂元素的工程文档和技术工作流程。
| 特征 | PDF/A-3 | PDF/A-4 |
|---|---|---|
| 基础 PDF 版本 | PDF 1.7 | PDF 2.0 |
| 嵌入式文件附件 | 支持 | 不支持 |
| 数字签名 | 支持 | 增强支持 |
| 最佳使用案例 | 发票、XML 数据嵌入 | 工程、3D 模型、技术工作流程 |
转换为最新的 PDF/A-4 标准
PDF/A-4 是 PDF/A 系列中最新的合规标准。 对于各种类型的文档,尤其是涉及数字签名的文档,它被认为是最佳的存档格式。 格式不允许加密和多媒体元素,确保每个文件保持完全独立。
将现有文件转换为符合 PDF/A-4 标准的文件非常简单。
using IronPdf;
// Load an existing PDF
PdfDocument pdf = PdfDocument.FromFile("input.pdf");
// Save as PDF/A-4 compliant document
pdf.SaveAsPdfA("pdfa4-output.pdf", PdfAVersions.PdfA4);Imports IronPdf
' Load an existing PDF
Dim pdf As PdfDocument = PdfDocument.FromFile("input.pdf")
' Save as PDF/A-4 compliant document
pdf.SaveAsPdfA("pdfa4-output.pdf", PdfAVersions.PdfA4)从现有 PDF 文件 (PDF/A-3B)
此示例使用wikipedia.pdf,这是使用IronPDF生成的PDF文件。 为获得最佳效果,请确保您在开始转换之前已正确配置了许可证密钥。
下面的代码以 PDF/A-3B 和 PDF/A-4 两种兼容格式加载和重新保存文件,以演示与这两种标准的兼容性。
输入的 PDF 在转换前是什么样子?
哪些代码可将现有 PDF 转换为 PDF/A 格式?
using IronPdf;
// Create a PdfDocument object or open any PDF File
PdfDocument pdf = PdfDocument.FromFile("wikipedia.pdf");
// Use the SaveAsPdfA method to save to file
pdf.SaveAsPdfA("pdf-a3-wikipedia.pdf", PdfAVersions.PdfA3b);Imports IronPdf
' Create a PdfDocument object or open any PDF File
Dim pdf As PdfDocument = PdfDocument.FromFile("wikipedia.pdf")
' Use the SaveAsPdfA method to save to file
pdf.SaveAsPdfA("pdf-a3-wikipedia.pdf", PdfAVersions.PdfA3b)如何验证 PDF/A 转换是否成功?
输出文件符合 PDF/A-3b

来自 HTML 设计或 URL (PDF/A-3B)
这个例子使用design.html,这是一个HTML设计文件,通过IronPDF从HTML渲染到PDF并导出为PDF/A兼容文件。HTML文件到PDF转换过程在转换期间保持所有样式和格式。
下面的代码将输出保存为符合 PDF/A-3B 标准的 PDF 文件。
如何将 HTML 文件转换为 PDF/A 格式?
using IronPdf;
// Use the Chrome Renderer to make beautiful HTML designs
var chromeRenderer = new ChromePdfRenderer();
// Render an HTML design as a PdfDocument object using Chrome
PdfDocument pdf = chromeRenderer.RenderHtmlAsPdf("design.html");
// Use the SaveAsPdfA method to save to file
pdf.SaveAsPdfA("design-accessible.pdf", PdfAVersions.PdfA3b);Imports IronPdf
' Use the Chrome Renderer to make beautiful HTML designs
Private chromeRenderer = New ChromePdfRenderer()
' Render an HTML design as a PdfDocument object using Chrome
Private pdf As PdfDocument = chromeRenderer.RenderHtmlAsPdf("design.html")
' Use the SaveAsPdfA method to save to file
pdf.SaveAsPdfA("design-accessible.pdf", PdfAVersions.PdfA3b)输出文件符合 PDF/A-3B

如何将网站转换为 PDF/A 格式?
此示例使用IronPDF从URL渲染https://www.microsoft.com到PDF并导出为PDF/A兼容文件。URL到PDF的转换功能确保所有网页内容,包括JavaScript和CSS,都被正确渲染。
下面的代码将输出保存为符合 PDF/A-3B 标准的 PDF 文件。
using IronPdf;
// Use the Chrome Renderer to make beautiful HTML designs from URLs
var chromeRenderer = new ChromePdfRenderer();
// Render a Website as a PdfDocument object using Chrome
PdfDocument pdf = chromeRenderer.RenderUrlAsPdf("https://www.microsoft.com");
// Use the SaveAsPdfA method to save to file
pdf.SaveAsPdfA("website-accessible.pdf", PdfAVersions.PdfA3b);Imports IronPdf
' Use the Chrome Renderer to make beautiful HTML designs from URLs
Private chromeRenderer = New ChromePdfRenderer()
' Render a Website as a PdfDocument object using Chrome
Private pdf As PdfDocument = chromeRenderer.RenderUrlAsPdf("https://www.microsoft.com")
' Use the SaveAsPdfA method to save to file
pdf.SaveAsPdfA("website-accessible.pdf", PdfAVersions.PdfA3b)输出文件符合 PDF/A-3B

支持嵌入附件(PDF/A-3B)
IronPDF 支持在 PDF/A 转换过程中使用文件路径、字节数组或流将文件嵌入 PDF 文档。 该功能可创建包含所有必要辅助材料的独立存档文件。 有关更多高级 PDF 操作功能,请查看我们的 PDF 编辑教程。
使用文件路径嵌入
使用文件路径嵌入文件。 我们提供了一系列文件路径,这些文件将在 PDF/A 转换过程中作为附件包含在内。
using IronPdf;
using System.Collections.Generic;
PdfDocument pdf = new PdfDocument("Google.pdf");
// Initialize collection of embed file as string of path
IEnumerable<string> embedPaths = new[] { "File1.xml", "File2.png" };
// Convert to Pdf/A-3B with embeded files
pdf.ConvertToPdfA(embedPaths);Imports IronPdf
Imports System.Collections.Generic
Private pdf As New PdfDocument("Google.pdf")
' Initialize collection of embed file as string of path
Private embedPaths As IEnumerable(Of String) = { "File1.xml", "File2.png" }
' Convert to Pdf/A-3B with embeded files
pdf.ConvertToPdfA(embedPaths)如何使用字节数组嵌入文件?
通过将文件内容作为字节数组提供及其文件类型嵌入文件。当文件已经加载到内存中时特别有用。
using IronPdf;
using System.Collections.Generic;
using System.IO;
PdfDocument pdf = new PdfDocument("Google.pdf");
// Initialize collection of embed file as Bytes and their file type
byte[] fileData1 = File.ReadAllBytes("File1.png");
byte[] fileData2 = File.ReadAllBytes("File2.xml");
var embedFileConfig1 = new EmbedFileConfiguration(EmbedFileType.png);
embedFileConfig1.EmbedFileName = "logo.png";
var embedFileConfig2 = new EmbedFileConfiguration(EmbedFileType.xml)
{
EmbedFileName = "supportSystem.xml",
AFDesc = "Internal system",
ConformanceLevel = ConformanceLevel.XRECHNUNG,
SchemaNamespace = SchemaNamespace.Zugferd1,
SchemaPrefix = SchemaPrefix.rsm,
PropertyVersion = PropertyVersion.v1p0,
AFRelationship = AFRelationship.Supplement,
};
IEnumerable<EmbedFileByte> embedBytes = new[]
{
new EmbedFileByte(fileData1, embedFileConfig1),
new EmbedFileByte(fileData2, embedFileConfig2)
};
// Convert to Pdf/A-3B with embeded files
pdf.ConvertToPdfA(embedBytes).SaveAs("PdfACompliance.pdf");Imports IronPdf
Imports System.Collections.Generic
Imports System.IO
Private pdf As New PdfDocument("Google.pdf")
' Initialize collection of embed file as Bytes and their file type
Private fileData1() As Byte = File.ReadAllBytes("File1.png")
Private fileData2() As Byte = File.ReadAllBytes("File2.xml")
Private embedFileConfig1 = New EmbedFileConfiguration(EmbedFileType.png)
embedFileConfig1.EmbedFileName = "logo.png"
Dim embedFileConfig2 = New EmbedFileConfiguration(EmbedFileType.xml) With {
.EmbedFileName = "supportSystem.xml",
.AFDesc = "Internal system",
.ConformanceLevel = ConformanceLevel.XRECHNUNG,
.SchemaNamespace = SchemaNamespace.Zugferd1,
.SchemaPrefix = SchemaPrefix.rsm,
.PropertyVersion = PropertyVersion.v1p0,
.AFRelationship = AFRelationship.Supplement
}
Dim embedBytes As IEnumerable(Of EmbedFileByte) = {
New EmbedFileByte(fileData1, embedFileConfig1),
New EmbedFileByte(fileData2, embedFileConfig2)
}
' Convert to Pdf/A-3B with embeded files
pdf.ConvertToPdfA(embedBytes).SaveAs("PdfACompliance.pdf")如何使用流嵌入文件?
使用流为内容嵌入文件及其文件类型。以流的形式处理文件数据时的理想选择。
using IronPdf;
using System.Collections.Generic;
using System.IO;
PdfDocument pdf = new PdfDocument("Google.pdf");
// Initialize collection of embed file as Stream and their file type
Stream stream1 = new MemoryStream(File.ReadAllBytes("File1.png"));
Stream stream2 = new MemoryStream(File.ReadAllBytes("File2.xml"));
var embedFileConfig1 = new EmbedFileConfiguration(EmbedFileType.png);
embedFileConfig1.EmbedFileName = "logo.png";
var embedFileConfig2 = new EmbedFileConfiguration(EmbedFileType.xml)
{
EmbedFileName = "supportSystem.xml",
AFDesc = "Internal system",
ConformanceLevel = ConformanceLevel.XRECHNUNG,
SchemaNamespace = SchemaNamespace.Zugferd1,
SchemaPrefix = SchemaPrefix.rsm,
PropertyVersion = PropertyVersion.v1p0,
AFRelationship = AFRelationship.Supplement,
};
IEnumerable<EmbedFileStream> embedStreams = new[]
{
new EmbedFileStream(stream1, embedFileConfig1),
new EmbedFileStream(stream2, embedFileConfig2)
};
// Convert to Pdf/A-3B with embeded files
pdf.ConvertToPdfA(embedStreams).SaveAs("PdfACompliance.pdf");Imports IronPdf
Imports System.Collections.Generic
Imports System.IO
Private pdf As New PdfDocument("Google.pdf")
' Initialize collection of embed file as Stream and their file type
Private stream1 As Stream = New MemoryStream(File.ReadAllBytes("File1.png"))
Private stream2 As Stream = New MemoryStream(File.ReadAllBytes("File2.xml"))
Private embedFileConfig1 = New EmbedFileConfiguration(EmbedFileType.png)
embedFileConfig1.EmbedFileName = "logo.png"
Dim embedFileConfig2 = New EmbedFileConfiguration(EmbedFileType.xml) With {
.EmbedFileName = "supportSystem.xml",
.AFDesc = "Internal system",
.ConformanceLevel = ConformanceLevel.XRECHNUNG,
.SchemaNamespace = SchemaNamespace.Zugferd1,
.SchemaPrefix = SchemaPrefix.rsm,
.PropertyVersion = PropertyVersion.v1p0,
.AFRelationship = AFRelationship.Supplement
}
Dim embedStreams As IEnumerable(Of EmbedFileStream) = {
New EmbedFileStream(stream1, embedFileConfig1),
New EmbedFileStream(stream2, embedFileConfig2)
}
' Convert to Pdf/A-3B with embeded files
pdf.ConvertToPdfA(embedStreams).SaveAs("PdfACompliance.pdf")如何使用EmbedFileConfiguration配置嵌入文件属性?
在将EmbedFileStream以指定文件类型、名称和自定义XMP元数据。
适当的配置可确保有效组织嵌入内容,并符合 PDF/A-3 标准。 自定义 XMP 元数据可以获得有关嵌入文件的更多信息,从而提高文档的可用性和可访问性。 使用EmbedFileConfiguration类,开发人员可以轻松定制文件的值和格式。
var config = new EmbedFileConfiguration
{
EmbedFileName = "Attachment.xml",
AFDesc = "Associated File Description",
ConformanceLevel = ConformanceLevel.EN16931,
SchemaNamespace = SchemaNamespace.facturX,
SchemaPrefix = SchemaPrefix.fx,
PropertyVersion = PropertyVersion.v1,
AFRelationship = AFRelationship.Alternative
};
// Load a PDF document
var document = PdfDocument.FromFile("wikipedia.pdf");
// Configure embedded file parameters
document.EmbedFileFromFilePath("path/to/attachment", config);
// Save the document as PDF/A-3b
document.SaveAsPdfA3B("output-with-configured-attachment.pdf");Imports System
Dim config As New EmbedFileConfiguration With {
.EmbedFileName = "Attachment.xml",
.AFDesc = "Associated File Description",
.ConformanceLevel = ConformanceLevel.EN16931,
.SchemaNamespace = SchemaNamespace.facturX,
.SchemaPrefix = SchemaPrefix.fx,
.PropertyVersion = PropertyVersion.v1,
.AFRelationship = AFRelationship.Alternative
}
' Load a PDF document
Dim document = PdfDocument.FromFile("wikipedia.pdf")
' Configure embedded file parameters
document.EmbedFileFromFilePath("path/to/attachment", config)
' Save the document as PDF/A-3b
document.SaveAsPdfA3B("output-with-configured-attachment.pdf")string属性。 默认为空字符串。string属性。默认是空字符串。ConformanceLevel:应用于PDF/A文档的XMP元数据的XML文件嵌入标准级别。 默认是ConformanceLevel.EN16931。 IronPDF通过ConformanceLevel枚举提供不同的值。SchemaNamespace:PDF/A架构命名空间URI,嵌入XML文件并应用于PDF/A文档的XMP元数据。 默认是SchemaNamespace枚举中提供各种选项。SchemaPrefix:适用于PDF/A文档XMP元数据的XML文件嵌入架构前缀。 默认是SchemaPrefix.fx,SchemaPrefix枚举中提供几种选项。PropertyVersion:应用于PDF/A文档XMP元数据的XML文件嵌入的属性版本。 默认是PropertyVersion枚举中有多个选项。AFRelationship:相关文件(嵌入文件)与PDF/A文档的关系。AFRelationship枚举中有几个选项可用。
是什么导致了 PDF/A 中的字符显示问题?
PDF/A 要求将文档中的所有字符映射到视觉和语义正确的字体上。 虽然并非所有字体都必须嵌入,但所使用的字体必须支持所需的字形。如果使用了不正确或不完整的字体,某些字符可能会出现断裂、缺失或错误呈现的情况,尤其是在使用特殊脚本或符号的语言中。 关于文件大小优化的注意事项,请浏览我们的PDF压缩指南,以平衡字体嵌入与文件大小之间的关系。
为什么某些字符在 PDF/A 文档中出现断裂?
例如,在下面的问题中,上面的样本使用了正确的字体并能正确显示字符,而下面的样本由于字体不匹配而无法正确显示字符。

从现有 PDF 文件 (PDF/A-4)
本示例使用 "ENV-2026-1847-Assessment-Report.pdf",这是一份 8 页的市政环境影响评估文件。 该报告证明了 PDF/A-4 适用于归档需要长期保存的政府官方文件--环境研究、监管文件和机构必须保留数十年的合规记录。
PDF/A-4 是这些文档的理想选择,因为它能保证长期的视觉保真度,嵌入所有字体和资源,并支持官方认证所需的增强型数字签名功能。
输入文件:"ENV-2026-1847-Assessment-Report.pdf"
代码
using IronPdf;
// Load the environmental impact assessment document
PdfDocument pdf = PdfDocument.FromFile("ENV-2026-1847-Assessment-Report.pdf");
// Save as PDF/A-4 compliant document for long-term archival
pdf.SaveAsPdfA("ENV-2026-1847-Report-PDFA4Compliant.pdf", PdfAVersions.PdfA4);Imports IronPdf
' Load the environmental impact assessment document
Dim pdf As PdfDocument = PdfDocument.FromFile("ENV-2026-1847-Assessment-Report.pdf")
' Save as PDF/A-4 compliant document for long-term archival
pdf.SaveAsPdfA("ENV-2026-1847-Report-PDFA4Compliant.pdf", PdfAVersions.PdfA4)输出
输出文件符合 PDF/A-4 标准:

准备好看看您还能做些什么吗? 查看我们的教程页面:创建PDF
常见问题解答
如何用 C# 将标准 PDF 转换为 PDF/A-3b 格式?
using IronPDF,只需两行代码,您就可以将任何标准 PDF 转换为 PDF/A-3b 格式。只需使用 PdfDocument.FromFile() 加载 PDF,然后调用 SaveAsPdfA() 将其导出为兼容的 PDF/A-3b 文档,以便长期存档。
什么是 PDF/A-3b,为什么它对文件存档很重要?
PDF/A-3b 是 ISO PDF 规范的一个严格子集,旨在长期保存文档。IronPDF 支持 PDF/A-3b 导出,以确保您的文档始终按保存的格式呈现,因此非常适合文档完整性至关重要的法律、政府和存档用途。
PDF/A 转换是否支持第 508 条可访问性合规性?
是的,IronPDF 通过使用谷歌 Chromium 的渲染引擎,继承了谷歌的可访问性功能,从而确保符合第 508 条的规定。这意味着使用屏幕阅读器等辅助技术的残疾用户可以访问您的 PDF/A 文档。
我可以将 HTML 内容直接转换为 PDF/A 格式吗?
当然可以!IronPDF 允许您将 HTML 内容或 URL 直接转换为 PDF/A-3b 格式。在将 HTML 转换为 PDF 的过程中,Google Chromium 渲染引擎会保留所有可访问性功能,确保您生成的 PDF/A 文档完全合规。
与标准 PDF 格式相比,使用 PDF/A-3b 的主要好处是什么?
IronPDF 的 PDF/A-3b 导出可保证长期保存、在所有阅读器上呈现一致的效果、符合第 508 条可访问性规定并遵守 ISO 存档标准。这使其成为法律文件、政府记录和任何需要永久存档的内容的完美选择。
Does IronPDF allow embedding files within PDF/A documents?
IronPDF supports embedding files in PDF/A-3B documents using file paths, byte arrays, or streams. This feature is useful for creating self-contained archival documents with all necessary supporting materials included.
What steps are involved in converting PDFs to PDF/A format using IronPDF?
The process involves downloading the IronPDF library, loading an existing PDF or rendering from HTML/URL, selecting the desired PDF/A version, and finally converting and saving the document as a PDF/A-compliant file.
How can IronPDF help solve character display issues in PDF/A documents?
Character display issues often arise due to incorrect font mappings. IronPDF ensures that appropriate fonts supporting required glyphs are used, preventing broken or missing characters and maintaining the document's visual integrity over time.
What types of documents benefit from conversion to PDF/A-4 using IronPDF?
PDF/A-4 is suitable for documents that require long-term preservation, such as engineering documents, environmental studies, regulatory filings, and compliance records. IronPDF ensures these documents remain visually consistent and digitally signed if needed.
Why is PDF/A compliance important for archival and regulatory documents?
PDF/A compliance is crucial for ensuring that documents can be reliably preserved and rendered over time. It meets legal and regulatory requirements for document archiving and ensures accessibility and integrity for future access.

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。