C#でPDFをPDF/Aに変換する方法 IronPDFを使用して

How to Export PDF/A or PDF/A-3 Format Documents in C#

This article was translated from English: Does it need improvement?
Translated
View the article in English
role="alert">あなたの企業は、PDFのセキュリティとコンプライアンスの年間サブスクリプションに多くを費やしています。デジタル署名、墨消し、暗号化、保護などのSaaSサービスを管理するソリューションを、一度の支払いで提供するIronSecureDocを検討してください。IronSecureDocのドキュメンテーションを探索する

PDFアソシエーションのメンバーとして、Iron SoftwareはPDF/A標準を積極的にサポートし、IronPDFがアーカイブコンプライアンス要件を満たしていることを保証しています。

IronPDFは、PDFをPDF/A-3b標準にエクスポートすることをサポートします。 PDF/A-3Bは、ISO PDFの仕様の厳密なサブセットで、文書のアーカイブ版を作成するために使用され、保存されたときとまったく同じように表示されることを意図しています。

クイックスタート: C#でPDFをPDF/A-3bに変換する

IronPDFを使用して、わずか数行のC#コードで標準のPDFをアーカイブフォーマットのPDF/A-3bに簡単に変換できます。 これにより、長期的な文書保存とアーカイブ標準への準拠が保証されます。 IronPDFの強力な機能を活用することで、既存のドキュメントを迅速にPDF/A形式に変換し、安定した表示とアクセシビリティを保証できます。

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronPDF with NuGet Package Manager

    PM > Install-Package IronPdf

  2. Copy and run this code snippet.

    IronPdf.PdfDocument pdf = IronPdf.PdfDocument.FromFile("example.pdf");
    pdf.SaveAsPdfA("output.pdf");
  3. Deploy to test on your live environment

    Start using IronPDF in your project today with a free trial
    arrow pointer

セクション508準拠

IronPDFは、GoogleのPDFアーカイブとアクセシビリティ、およびPDF文書のセクション508準拠を強化するための取り組みに喜んで従っています。

2021年に、Google Chromium HTMLレンダリングエンジンを使用してHTMLからPDFをレンダリングすることに移行しました。これにより、私たちのソフトウェアはGoogleがすでに実装しているアクセシビリティの作業を継承することができます。

IronPDFの始め方

今日あなたのプロジェクトでIronPDFを無料トライアルで使用開始。

最初のステップ:
green arrow pointer


class="hsg-featured-snippet">

最小ワークフロー(5ステップ)

C#でHTML文字列をPDFにレンダリングする方法
  1. PDF/Aドキュメントを作成するためのC#ライブラリをダウンロード
  2. 既存のPDFをロードするか、ファイル、HTML、またはURLから作成する
  3. 既存のPDFファイルからPDF/Aドキュメントをエクスポートする
  4. HTMLデザインまたはURLからPDF/Aドキュメントをエクスポートする
  5. PDF/A準拠のドキュメントを希望の場所に保存する

PDF/Aバージョン

IronPDFがサポートする2つの適合レベルは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形式はオリジナルのPDF 1.4バージョンに基づいています。

PDF/A-2: 2011年7月にISO 32001-1という新しい標準としてリリースされ、この標準は1.7までのPDFバージョンのすべての機能を含み、新しい機能も追加されています。 その機能にはJPEG2000のサポートが含まれており、スキャンされた文書には便利で、カスタマイズされたXMPメタデータの特定の要件があります。

PDF/A-3: このPDF/A形式はレベル2のすべての要件を含んでいます。さらに、XML、CSV、ワードプロセッシング形式などの追加ファイル形式をPDF/A準拠ドキュメントに埋め込むことができます。

ご注意IronPdfは、添付ファイルを持つPDFをPDF/A-3Bに変換することをまだサポートしていません。

既存のPDFファイルから

私は例のPDF "wikipedia.pdf"を持っており、それはIronPDFを使用して生成され、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)
$vbLabelText   $csharpLabel

出力

出力ファイルはPDF/A-3b準拠です:

ライセンス完了

HTMLデザインまたはURLから

私は次のHTMLデザイン "design.html"を持っており、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)
$vbLabelText   $csharpLabel

出力ファイルはPDF/A-3B準拠です:

ライセンス完了

URL例

私は次のウェブサイト "https://www.microsoft.com"を持っており、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)
$vbLabelText   $csharpLabel

出力ファイルはPDF/A-3B準拠です:

ライセンス完了


埋め込まれた添付ファイルのサポート

IronPdfは、PDFドキュメントにファイルを埋め込みながらPDF/A形式に変換する機能を提供します。 これは、ファイルパス、バイト配列、またはストリームなどのさまざまな入力タイプを使用して達成できます。

ファイルパスによる埋め込み

ファイルパスを使用してファイルを埋め込むことができます。 ファイルパスのコレクションが提供され、これらのファイルは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)
$vbLabelText   $csharpLabel

バイト配列による埋め込み

ファイルタイプと一緒にファイルコンテンツをバイト配列として提供することでファイルを埋め込むことができます。これは、ファイルがすでにメモリにロードされている場合に便利です。

: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")
$vbLabelText   $csharpLabel

ストリームによる埋め込み

そのコンテンツのためのストリームを使用してファイルを埋め込む機能を提供し、それと一緒にファイルタイプを指定します。このメソッドは、ファイルデータがストリームとして処理されるシナリオに最適です。

: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")
$vbLabelText   $csharpLabel

EmbedFileConfigurationを探索する

埋め込まれたファイルを含むPDF/A-3形式にPdfDocumentを変換する際には、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");
Dim config = 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")
$vbLabelText   $csharpLabel
  • EmbedFileName: PDF/Aドキュメント内の埋め込まれたファイルの名前を表すstringプロパティ。 デフォルトでは、この文字列は空です。
  • AFDesc: A string property representing the associated file description for the embedded file. デフォルトでは、この文字列は空です。
  • ConformanceLevel: XMLファイルの埋め込みに適用されるPDF/AドキュメントのXMPメタデータの適合レベル。 デフォルトはConformanceLevel.EN16931です。 IronPDFはConformanceLevel列挙体を介してさまざまな値を提供します。
  • SchemaNamespace: PDF/AスキーマNamespaceURIでXMLファイルを埋め込み、PDF/AドキュメントのXMPメタデータに適用します。 デフォルトはSchemaNamespace.facturXで、開発者にSchemaNamespace列挙体でさまざまなオプションが提供されます。
  • SchemaPrefix: PDF/Aスキーマ接頭辞でXMLファイルを埋め込み、PDF/AドキュメントのXMPメタデータに適用します。 デフォルトはSchemaPrefix.fxで、SchemaPrefix列挙体にいくつかのオプションがあります。
  • PropertyVersion: PDF/AドキュメントのXMPメタデータに適用される埋め込みXMLファイルのプロパティバージョン。 デフォルトはPropertyVersion.v1で、PropertyVersion列挙体に複数のオプションがあります。
  • AFRelationship: PDF/Aドキュメントに関連するファイル(埋め込まれたファイル)の関係。 AFRelationship列挙体にはいくつかのオプションがあります。

文字表示の問題

PDF/Aでは、ドキュメント内のすべての文字が視覚的および意味的に正しいフォントにマッピングされている必要があります。 すべてのフォントを埋め込む必要はありませんが、使用されるフォントは必要なグリフをサポートしている必要があります。不適切または不完全なフォントが使用されると、特に特殊なスクリプトや記号がある言語では、特定の文字が壊れたり欠落したり、誤って表示されたりすることがあります。

以下の例では、上のサンプルは正しいフォントを使用し、文字を適切に表示しますが、下のサンプルはフォントの不一致により文字を正しくレンダリングできません。

表示の問題

次に何ができるのかを見てみましょうか? こちらのチュートリアルページをご覧ください:PDFの作成

よくある質問

C#でPDFをPDF/A形式に変換する方法は?

C#で標準のPDFをPDF/A形式に変換するには、IronPDFの変換機能を使用できます。これは、PDF文書を読み込み、指定されたPDF/A準拠レベルで保存することによって行われます。

PDF/A-3bと他のPDF/A基準の違いは何ですか?

PDF/A-3bは、文書が一貫して表示されることを保証することにより、文書の長期保存に焦点を当てたISO PDF仕様のサブセットです。他のPDF/A基準とは異なり、PDF/A-3bはXMLやCSVなどの追加ファイルを文書内に埋め込むことを許可しています。

C#を使用してPDF/A文書にファイルを埋め込む方法は?

IronPDFは、ファイルパス、バイト配列、またはストリームを介してXMLやCSVなどのファイルをPDF/A文書に埋め込むことができます。これは、EmbedFileConfigurationクラスを使用して、ファイル名、説明、メタデータなどのパラメーターを設定することにより構成されます。

HTMLまたはURLコンテンツをPDF/A-3bに変換することはできますか?

はい、IronPDFはHTMLコンテンツやURLをPDF/A-3bに変換できます。これは、HTMLまたはURLをPDF形式にレンダリングし、その後PDF/A-3b準拠で文書を保存することを含みます。

PDF/A文書でサポートされているアクセシビリティ機能は何ですか?

IronPDFはGoogleのChromium HTMLレンダリングエンジンを使用しており、Googleによって実装されたアクセシビリティ機能を継承しているため、セクション508基準に準拠したPDF/A文書のアクセシビリティをサポートします。

PDF/A文書をセクション508に準拠させるためにはどうすればよいですか?

IronPDFは、GoogleのChromium HTMLレンダリングエンジンのアクセシビリティ機能を利用してPDF/A文書をセクション508に準拠させ、支援ソフトウェアのためにPDFをアクセシブルにするのを助けます。

EmbedFileConfigurationクラスの目的は何ですか?

IronPDFのEmbedFileConfigurationクラスは、PDF/A文書にファイルを埋め込むためのパラメーターを設定することを開発者に許可し、ファイルのメタデータを指定し、PDF/A-3基準への準拠を保証します。

添付ファイル付きのPDFをPDF/A-3b形式に変換することはできますか?

IronPDFは添付ファイル付きPDFをPDF/A-3bに変換できますが、添付ファイルは、IronPDFが提供する適切な方法を使用して特に構成および埋め込みされる必要があります。

IronPDFが提供するPDF/A変換の利点は何ですか?

IronPDFは、アーカイブ基準順守、さまざまな入力形式のサポート、追加ファイルの埋め込み機能、および包括的なメタデータカスタマイズを含む、PDF/A変換においていくつかの利点を提供します。

IronPDF は PDF/A 形式に変換するときに .NET 10 と互換性がありますか?

はい。IronPDFは.NET 10と完全に互換性があり、SaveAsPdfAなどのPDF/A変換機能とChromePdfRendererによるレンダリングをサポートしています。特別な回避策なしで.NET 10プロジェクトで使用できます。また、.NET 10をターゲットとしながら、Windows、Linux、macOS、コンテナーへのデプロイもサポートしています。

Curtis Chau
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

準備はいいですか?
Nuget ダウンロード 16,154,058 | バージョン: 2025.11 ただ今リリースされました