How to Export PDF/A, PDF/A-3, or PDF/A-4 Format Documents in C
IronPDF 支援將 PDF 檔案匯出為 PDF/A-3b 和 PDF/A-4 標準格式。 PDF/A-3B 是 ISO PDF 規格的嚴格子集,用於建立文件的歸檔版本,其設計宗旨是確保文件在任何情況下都能與儲存時的樣式完全一致。 PDF/A-4 是最新的合規標準,提供對數位簽名的增強支援。
第 508 條合規性
IronPDF 遵循 Google 的倡議,致力於提升 PDF 歸檔與無障礙功能,以符合《第 508 條》規範。 在進行 HTML 轉 PDF/A 轉換時,我們的渲染引擎會完整保留所有無障礙功能。
2021 年,我們改為使用 Google Chromium 的 HTML 渲染引擎,將 HTML 轉換為 PDF。此舉使我們的軟體能繼承 Google 已實作的無障礙功能。
為何 PDF/A 文件必須符合第 508 條規定?
符合第 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"代表"可存取(accessible)","B"代表"基礎(basic)"。這些等級適用於 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 及 WORD 格式)嵌入符合 PDF/A 標準的文件中。
PDF/A-4:PDF/A 合規標準的最新版本,於 2020 年發布。該版本基於 PDF 2.0,並引入了多項功能改進,包括相較於 PDF/A-3 更強大的數位簽章支援。此版本最適合用於涉及 3D 模型及其他複雜元素的工程文件與技術工作流程。
| 功能 | 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 標準的格式相當簡單。
:path=/static-assets/pdf/content-code-examples/how-to/sample-pdfa4.cs
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 格式?
:path=/static-assets/pdf/content-code-examples/how-to/pdfa-fromfile.cs
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
Private 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 格式?
:path=/static-assets/pdf/content-code-examples/how-to/pdfa-fromhtml.cs
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 將 https://www.microsoft.com 從 URL 渲染為 PDF,並將其匯出為符合 PDF/A 標準的檔案。此 URL 轉 PDF 功能可確保所有網頁內容(包括 JavaScript 和 CSS)皆能正確渲染。
以下程式碼會將輸出結果儲存為符合 PDF/A-3B 標準的 PDF 檔案。
:path=/static-assets/pdf/content-code-examples/how-to/pdfa-fromurl.cs
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 轉換過程中作為附件一併包含。
:path=/static-assets/pdf/content-code-examples/how-to/pdfa-attachment-path.cs
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)
如何使用位元組陣列嵌入檔案?
透過提供包含檔案類型的位元組陣列來嵌入檔案。此方法適用於檔案已載入記憶體的情況。
:path=/static-assets/pdf/content-code-examples/how-to/pdfa-attachment-byte.cs
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")
如何使用串流嵌入檔案?
使用流來嵌入檔案,並保留其檔案類型。當檔案資料以流的形式處理時,此方法最為理想。
:path=/static-assets/pdf/content-code-examples/how-to/pdfa-attachment-stream.cs
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 設定嵌入式檔案的屬性?
當將 PdfDocument 轉換為帶有嵌入檔案的 PDF/A-3 格式時,請設定 EmbedFileByte 或 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");
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");
Option Strict On
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")
EmbedFileName:一個string屬性,代表 PDF/A 文件中的嵌入檔案名稱。 預設值為空字串。AFDesc:一個string屬性,代表嵌入檔案的相關檔案描述。預設值為空字串。ConformanceLevel:適用於 PDF/A 文件 XMP 元資料中嵌入 XML 檔案的符合性等級。 預設值為ConformanceLevel.EN16931。 IronPDF 透過ConformanceLevel枚舉提供不同的值。SchemaNamespace:PDF/A 架構的 NamespaceURI,用於嵌入 XML 檔案並套用至 PDF/A 文件的 XMP 元資料。 預設值為SchemaNamespace.facturX,並可在SchemaNamespace枚舉中選擇多種選項。SchemaPrefix:用於嵌入 XML 檔案的 PDF/A 架構前綴,適用於 PDF/A 文件的 XMP 元資料。 預設值為SchemaPrefix.fx,並在SchemaPrefix枚舉中提供數個選項。PropertyVersion:應用於 PDF/A 文件 XMP 元資料中,用於嵌入 XML 檔案的屬性版本。 預設值為PropertyVersion.v1,並在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"
程式碼
:path=/static-assets/pdf/content-code-examples/how-to/save-as-pdfa4.cs
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 格式?
透過 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 透過採用 Google Chromium 的渲染引擎來確保符合《第 508 條》規範,該引擎繼承了 Google 的無障礙功能。這意味著您的 PDF/A 文件將可供使用螢幕閱讀器等輔助技術的殘障使用者存取。
我可以直接將 HTML 內容轉換為 PDF/A 格式嗎?
沒問題!IronPDF 允許您將 HTML 內容或網址直接轉換為 PDF/A-3b 格式。Google Chromium 渲染引擎在 HTML 轉 PDF 的過程中會完整保留所有無障礙功能,確保生成的 PDF/A 文件完全符合規範。
相較於標準 PDF 格式,使用 PDF/A-3b 的主要優勢為何?
IronPDF 的 PDF/A-3b 匯出功能提供有保障的長期保存、跨所有檢視器的渲染一致性、符合《第 508 條》無障礙規範,並遵循 ISO 歸檔標準。這使其非常適合用於法律文件、政府紀錄,以及任何需要永久歸檔的內容。

