C#でPDF/AまたはPDF/A-3形式のドキュメントをエクスポートする方法
IronPDFはPDF/A-3b 標準へのPDFのエクスポートをサポートしています。 PDF/A-3Bは、保存された時と同じように常に正確に表示されることを意図して作成される文書のアーカイブバージョンを作成するために使用されるISO PDF仕様の厳密なサブセットです。
セクション508準拠
IronPDFはPDFのアーカイブとアクセシビリティ、そしてPDFドキュメントのセクション508コンプライアンスを向上させるGoogleのイニシアチブに喜んで賛同します。
2021年、Google Chromium HTMLレンダリングエンジンを使用して、HTMLからPDFをレンダリングすることに移行しました。これにより、当社のソフトウェアはアクセシビリティ作業 Googleはすでに以下の作業を実施しています。:
IronPDFを始めましょう
今日から無料トライアルでIronPDFをあなたのプロジェクトで使い始めましょう。
C#でPDFをPDF/Aに変換する方法

- PDF/Aドキュメント作成用C#ライブラリのダウンロード
- 既存のPDFを読み込むか、ファイル、HTML、またはURLからPDFを作成する
- 既存のPDFファイルからPDF/Aドキュメントを書き出す
- HTMLデザインまたはURLからPDF/Aドキュメントを書き出す
- PDF/A準拠のドキュメントを任意の場所に保存します。
PDF/Aバージョン
IronPDFがサポートする2つの適合性レベルはAとBです。 A」は「アクセシブル」を表し、「B」は「ベーシック」を表す。これらのレベルは、PDF/A-1、PDF/A-2、PDF/A-3の各規格で利用可能です。 以下の情報は以下から引用した。PDF/Aに関するアドビのドキュメント.
- レベルA適合は、その仕様のすべての要件を満たしており、身体障害者のアクセシビリティを向上させる支援ソフトウェアを可能にする。
-
レベルBは、適合性のレベルが低く、最小限の適合性で、長期的なファイルの視覚的な外観を維持することに重点を置いています。
PDF/A-1:PDF/Aフォーマットは、オリジナルのPDF 1.4バージョンに基づいています。
PDF/A-2:ISO 32001-1と呼ばれる新しい規格として2011年7月にリリースされたこの規格は、PDFバージョン1.7までのすべての機能と新しい機能を含んでいます。 その特徴には、スキャン文書に便利なJPEG2000のサポートや、カスタマイズされたXMPメタデータの特定の要件が含まれます。
PDF/A-3:このPDF/Aフォーマットは、レベル2の要件をすべて含んでいます。また、XML、CSV、ワープロ形式などの追加ファイル形式をPDF/A準拠文書に埋め込むことができます。
次の内容にご注意ください。
IronPdfは、添付ファイル付きのPDFをPDF/A-3Bに変換することはまだサポートしていません。
既存のPDFファイルから
IronPDFを使用して生成され、PDFファイルとして保存されたサンプルPDF "wikipedia.pdf
"があります。
このデモでは、それをPDF/A-3B対応のPDFファイルとして読み込み、再保存します。
入力ファイル: "wikipedia.pdf"
コード
: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-3b準拠です。
HTMLデザインまたはURLから
HTMLデザインの例"design.html
"があるのですが、IronPDFを使ってHTMLからPDFにレンダリングし、PDF/A準拠のファイルとしてエクスポートしたいのですが。
このデモンストレーションでは、PDF/A-3B準拠のPDFファイルとして保存します。
HTMLデザイン例
: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に準拠しています。
URL例
以下のウェブサイト"https://www.microsoft.com
"があるのですが、IronPDFを使ってURLからPDFにレンダリングし、PDF/A準拠のファイルとしてエクスポートしたいのですが。
このデモンストレーションでは、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に準拠しています。
添付ファイルの埋め込みをサポート
IronPDFは、ファイルをPDF/A形式に変換する際に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")