如何在 C# 中匯出 PDF/A、PDF/A-3 或 PDF/A-4 格式文件
您的企業在PDF的安全性和合規性上每年花費過多。考慮使用IronSecureDoc,它提供管理SaaS服務如數位簽章、遮罩、加密和保護的解決方案,僅需一次性付款。瀏覽IronSecureDoc文檔
IronPDF 支援將 PDF 匯出為 PDF/A-3b 和 PDF/A-4標準。 PDF/A-3B 是 ISO PDF 規範的一個嚴格子集,用於建立文件的存檔版本,目的是使它們始終與儲存時完全相同。 PDF/A-4 是最新的合規標準,為數位簽章提供了更強大的支援。
第 508 條合規性
IronPDF 遵循 Google 的倡議,增加 PDF 的歸檔和可讀性,以符合 Section 508 的規定。
在2021年,我們轉向使用Google Chromium的HTML渲染引擎從HTML渲染PDF。這使得我們的軟體能繼承Google已實施的可訪問性工作。
為何PDF/A文檔的508節規範符合性如此重要?
符合 Section 508 規範可確保使用螢幕閱讀器等輔助技術的殘障人士能夠存取 PDF 文件。 符合 Section 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 19005-2:2011,包含所有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 更強大的數位簽章支援。此版本最適合涉及 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 標準的文件非常簡單。
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)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);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)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);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)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格式?
此範例將https://www.microsoft.com從URL渲染到PDF,使用IronPDF並將其導出為符合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);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)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);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)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");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")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");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")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格式時,配置如EmbedFilePath、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");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")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:表示PDF/A文件中嵌入文件名稱的string屬性。 預設為空字串。AFDesc:表示嵌入文件的相關文件描述的string屬性。默認為空字串。ConformanceLevel:應用於PDF/A文件XMP中繼資料的嵌入XML文件的合規級別。 默認為ConformanceLevel.EN16931。 IronPDF通過ConformanceLevel枚舉提供不同的值。SchemaNamespace:嵌入XML文件的PDF/A Schema NamespaceURI並應用於PDF/A文件的XMP中繼資料。 默認為SchemaNamespace.facturX,SchemaNamespace枚舉中有多種選項可選。SchemaPrefix:適用於PDF/A文件XMP Metadata中嵌入XML文件的PDF/A Schema前綴。 默認為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”
代碼
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);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)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
常見問題
什麼是PDF/A-3B 以及IronPDF如何支援?
PDF/A-3B 是一種ISO PDF規範的嚴格子集,用於創建保存版的文件,這些文件隨著時間的推移應保持一致的顯示。IronPDF支援將PDF匯出至PDF/A-3B標準,確保長期文件保存的合規性。
IronPDF如何確保第508條可存取性合規?
IronPDF使用Google Chromium的HTML渲染引擎來在HTML轉PDF過程中保持第508條可存取性功能。這確保了PDF文件對使用輔助技術的個體仍可存取,符合第508條標準。
PDF/A-1, PDF/A-2 和 PDF/A-3之間有什麼差異,以及IronPDF如何支援這些版本?
PDF/A-1基於原始的PDF 1.4標準,PDF/A-2包含了PDF 1.7的功能,而PDF/A-3則增加了對嵌入其他文件格式的支援。IronPDF支援所有這些標準,讓您根據您的保存需求選擇適當的版本。
IronPDF可以處理PDF/A文件中的數位簽章嗎?
可以,IronPDF支援加強的數位簽章功能,特別是在最新的PDF/A-4合規標準中,比之前的PDF/A版本提供了更好的數位簽章支援。
IronPDF如何將HTML或URL轉換為符合PDF/A的文件?
IronPDF能夠使用其Chrome Renderer將HTML文件或URL轉換為符合PDF/A的文件。這個過程確保所有網頁內容,包括樣式和JavaScript,能夠準確地渲染並轉換以滿足PDF/A標準。
IronPDF允許在PDF/A文件中嵌入文件嗎?
IronPDF支援在PDF/A-3B文件中使用文件路徑、位元組陣列或流來嵌入文件。這個功能對創建自包含的保存文件相當有用,其中包含所有必要的輔助材料。
使用IronPDF將PDF轉換為PDF/A格式涉及哪些步驟?
這個過程涉及下載IronPDF程式庫,載入現有的PDF或從HTML/URL渲染,選擇所需的PDF/A版本,最後轉換並儲存該文件為符合PDF/A的文件。
IronPDF如何幫助解決PDF/A文件中的字元顯示問題?
字元顯示問題通常由於字體對應錯誤引起。IronPDF確保使用支援所需字形的適當字體,防止字元損壞或遺漏,並保障文件的視覺完整性隨時間推移。
哪些類型的文件能從使用IronPDF轉換為PDF/A-4中受益?
PDF/A-4適用於需要長期保存的文件,如工程文件、環境研究、法規文件與合規紀錄。IronPDF確保這些文件從視覺上來看具有一致性,如果需要,還能進行數位簽章。
為什麼PDF/A合規性對於保存和法規文件很重要?
PDF/A合規性對於確保文件能夠可靠地保存和顯示至關重要。它符合文檔存檔的合法和法規要求,並確保未來的可及性和完整性。
Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。