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轉換時,我們的渲染引擎會保留所有可及性功能。
在2021年,我們開始使用Google Chromium的HTML渲染引擎來從HTML渲染PDF。這使得我們的軟體可以繼承Google已經實施的可及性工作。
為甚麼第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)。
- Level A合規性滿足所有規範要求,允許輔助軟體提高殘疾使用者的可接達性。
- Level B合規性較低,重點在於長期保存視覺外觀。
PDF/A-1、PDF/A-2和PDF/A-3之間有何不同?
PDF/A-1:基於原始的PDF 1.4版本。
PDF/A-2:於2011年7月作為ISO 32001-1發佈,包含所有至1.7版的PDF功能以及新特性。 支援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更強的數位簽名支持。此版本最適合用於需涉及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從URL將https://www.microsoft.com渲染到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配置嵌入文件屬性?
在使用嵌入文件轉換EmbedFileStream以指定文件型別、名稱和自定義XMP詮釋資料。
適當的配置確保嵌入內容有效組織並符合PDF/A-3標準。 自定義XMP詮釋資料允許有關嵌入文件的附加資訊,提高文件的可用性和可及性。 使用EmbedFileConfiguration類別,開發者能夠輕鬆自定義文件的值和格式。
:path=/static-assets/pdf/content-code-examples/how-to/pdfa-8.cs
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")
EmbedFileName: 一個string屬性,代表PDF/A文件中的嵌入文件名稱。 預設為空字串。AFDesc: 一個string屬性,代表嵌入文件的相關文件描述。預設為空字串。ConformanceLevel: 嵌入XML文件的合規級別,適用於PDF/A文件的XMP詮釋資料。 預設為ConformanceLevel.EN16931。 IronPDF通過ConformanceLevel枚舉提供不同的值。SchemaNamespace: 嵌入XML文件的PDF/A架構命名空間URI,適用於PDF/A文件的XMP詮釋資料。 預設為SchemaNamespace枚舉中提供了不同選項。SchemaPrefix: 嵌入XML文件的PDF/A架構前綴,適用於PDF/A文件的XMP詮釋資料。 預設為SchemaPrefix枚舉中提供了多個選項。PropertyVersion: 嵌入XML文件的屬性版本,適用於PDF/A文件的XMP詮釋資料。 預設為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內容或URL直接轉換為PDF/A-3b格式。Google Chromium的渲染引擎在將HTML轉換為PDF的過程中保留所有無障礙特性,確保生成的PDF/A文件完全合規。
使用PDF/A-3b而非標準PDF格式的主要優勢是什麼?
IronPDF的PDF/A-3b匯出提供保證的長期保存、一致的影像呈現、符合508條款的無障礙合規及符合ISO歸檔標準。這使其非常適合法律文件、政府記錄和任何需要永久保存的內容。

