フッターコンテンツにスキップ
製品比較

IronPDFとApitron PDF Kitの比較

C# で PDF ファイルを操作するのは、開発者にとって難しい場合があります。 これらのファイルのコンテンツを作成するときに考慮すべき要素は多数ありますが、異なる形式のコンテンツを PDF に変換するときにはさらに多くの要素を考慮する必要があります。 自動化は現在、ソフトウェア開発プロセスにおいて非常に重要です。 これらの課題は、PDF ドキュメントの読み取り、書き込み、作成、変更、および属性の編集や他の形式からの変換を支援するように設計されたライブラリの開発によって解決されました。

このブログ記事では、.NET と .NET Core の 2 つの PDF ライブラリを比較します。

  • IronPDFライブラリ
  • Apitron PDF Kit

IronPDF と Apitron PDF Kit は、.NET および .NET Core 用の PDF 操作機能を提供するライブラリです。 これらはドキュメントフィールドの変換および操作タスクに使用できます。 ブックマークの作成も可能です。 次のステップは、どの C# PDF .NET ライブラリが .NET プロジェクトに最適かを決定することです。 この記事の比較が、これら2つのPDFライブラリの選択を手助けします。

まず、2 つのライブラリが提供するものを確認し、次に比較に移ります。

Apitron PDF Kitライブラリとその機能

Apitron PDF Kit は、さまざまな方法で PDF ファイルを操作または変換できる .NET コンポーネントです。 画像、図面、テキストを追加したり、文書に署名したり、その他さまざまなことができます。 既存のコンテンツの編集も可能です。 Apitron PDF Kit .NETコンポーネントは、複数のプラットフォームでモバイル、デスクトップ、ウェブ、Windows、およびクラウドアプリケーションを作成するために使用できます。

このPDF SDKを使用すると、次のことができます:

  • グラフィック(テキスト、画像、図面)の抽出、変更、追加
  • PDFドキュメントの分割または結合
  • パスワード保護されたPDFフォームを作成または入力、FDFサポート
  • オプションのコンテンツ グループ (OCG) を使用して多層 PDF ドキュメントを作成します。
  • ドキュメントにフィールドを追加または削除する
  • 右から左または双方向テキストを使用してページコンテンツを作成
  • ドキュメント内のリソースを検査 - 定義されたフォント、埋め込まれたファイル
  • PDFドキュメントへのデジタル署名および既存の署名の検証

IronPDFの主な機能

開発者、特に C# プログラマーは IronPDF .NET ライブラリを高く評価するでしょう。 このツールを使用すると、.NET Core PDF 処理アプリケーションを簡単に構築できます。

IronPDF は .NET Chromium エンジンを使用して、HTML ページ (コードまたは URL 形式) を PDF ファイルに変換します。 ナビゲーション オブジェクトを配置したり、HTML から PDF を設計したりするために複雑な API を使用する必要はありません。 HTML、ASPX、JS、CSS、画像を含む標準のウェブドキュメントをIronPDFはサポートしています。

IronPDFは、HTML5、CSS、JS、画像を使用して作成できます。 PDFは簡単に編集、スタンプ、ヘッダーおよびフッターの追加が可能です。 また、PDF テキストの読み取りとグラフィックの抽出も簡単になります。

IronPDFの際立った機能には次のようなものがあります:

  • HTML4/5、CSS、およびJavaScriptを使用したPDFドキュメントの作成
  • カスタムネットワークログイン認証情報、ユーザーエージェント、プロキシ、クッキー、HTTPヘッダ、およびフォーム変数を使用してURLを読み込む(HTMLログインフォームの背後にログインを可能にします)
  • PDFフォームフィールドの読み取りと入力
  • PDFからのテキストとグラフィックの抽出
  • PDFページを新しいHTMLコンテンツで更新
  • テキストベースまたはHTMLベースのヘッダーとフッターの作成
  • PDFドキュメントコンテンツの結合および分割
  • ASP.NETウェブフォームを印刷可能なPDFに変換
  • Adobe Acrobatソフトウェア無しでPDFファイルを印刷

IronPDF は、以下を含む C# と互換性のあるほぼすべてのオペレーティング システムおよびフレームワークで利用できます。

  • .NET Core 2.1, 3.0, 3.1, .NET 6 & 5
  • ユニバーサル互換性のための.NET Standard 2.0準拠
  • Azure, AWS, Docker, Linux, Windows

この記事の残りの部分は以下の通りです:

  1. IronPDFのインストール
  2. Apitron PDF Kitのインストール
  3. PDFドキュメントの作成
  4. PDFにヘッダーとフッターを作成
  5. PDFにデジタル署名を付ける
  6. 価格とライセンス

1. IronPDFのインストール

IronPDFライブラリをダウンロードしてインストールする方法は4つあります。 以下のような方法です:

  1. NuGetパッケージマネージャーを使用
  2. 開発者コマンドプロンプト
  3. NuGetパッケージを直接ダウンロード
  4. IronPDF .DLLライブラリをダウンロード

1.1. NuGetパッケージマネージャーを使用

IronPDFをインストールするには、ソリューションエクスプローラーのプロジェクトを右クリックするだけです。 これにより、NuGetパッケージマネージャーが開きます。

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 1: ソリューションエクスプローラを使用したNuGetパッケージマネージャへのアクセス

ソリューションエクスプローラを使用したNuGetパッケージマネージャへのアクセス

選択後、下のスクリーンショットに示すようにIronPDFパッケージを探してインストールします。

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 2: NuGetパッケージマネージャを使用したIronPDFライブラリのインストール

NuGetパッケージマネージャを使用したIronPDFライブラリのインストール

1.2. 開発者コマンドプロンプトの使用

また、開発者コマンドプロンプトを使用してIronPDFをインストールすることもできます。

  • 開発者コマンドプロンプト を開きます。通常、Visual Studioフォルダーの下にあります。
  • 次のコマンドを入力:
Install-Package IronPdf
  • Enterキーを押します
  • これにより、パッケージがダウンロードおよびインストールされます
  • プロジェクトをリロードして使用を開始

1.3. NuGetパッケージを直接ダウンロード

IronPDFは、IronPDF NuGetパッケージサイトに直接アクセスしてダウンロードすることでもインストールできます。 手順は次の通りです:

  • IronPDF NuGetパッケージに移動
  • ダウンロードパッケージを選択
  • ダウンロードしたパッケージをダブルクリック
  • パッケージはインストールされます
  • Visual Studioプロジェクトをリロードし、使用を開始します

IronPDFはダウンロードされ、使用準備が整いました。 しかし、その前にApitron PDFライブラリをインストールする必要があります。

2. Apitron PDF Kitのインストール

.NET Coreアプリケーションの場合、NuGetパッケージマネージャーを使用してApitronをインストールするか、Apitron PDF Kit NuGetウェブサイトから直接ダウンロードしてインストールできます。

  • IronPDFで行ったように、Visual StudioでNuGetパッケージを開く。
  • Apitron.PDF.Kitを検索。
  • 現在のプロジェクトでインストールをクリック。
A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 3: アピトロンPDFキット検索

アピトロンPDFキット検索

NuGetパッケージマネージャーコンソールを使用してApitronをインストールすることもできます。 IronPDFで記載されている"開発者コマンドプロンプトを使用する"手順に従い、次のコマンドを入力します:

Install-Package Apitron.PDF.Kit

ENTERキーを押す。 Apitron.PDF.Kitをダウンロードしてインストールします。

次の名前空間を追加します。

using Apitron.PDF.Kit;
using Apitron.PDF.Kit.FixedLayout.Resources;
using Apitron.PDF.Kit.FixedLayout.Resources.Fonts;
using Apitron.PDF.Kit.FlowLayout.Content;
using Apitron.PDF.Kit.Styles;
using Apitron.PDF.Kit.Styles.Appearance;
using Font = Apitron.PDF.Kit.Styles.Text.Font;
using Apitron.PDF.Kit;
using Apitron.PDF.Kit.FixedLayout.Resources;
using Apitron.PDF.Kit.FixedLayout.Resources.Fonts;
using Apitron.PDF.Kit.FlowLayout.Content;
using Apitron.PDF.Kit.Styles;
using Apitron.PDF.Kit.Styles.Appearance;
using Font = Apitron.PDF.Kit.Styles.Text.Font;
$vbLabelText   $csharpLabel

それでは、IronPDFとApitron PDFの比較に進みましょう。

3. PDFドキュメントの作成

3.1. IronPDFを使用する

IronPDFはPDFを作成するための複数のメソッドを持っています。 重要なものを2つ見てみましょう。

既存のURLをPDFに変換

IronPDFは、任意のURLをPDFに変換するのが簡単です。 次のコードはURLをPDFに変換するのに役立ちます。

var Renderer = new IronPdf.ChromePdfRenderer();
// Render a PDF from an existing URL
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
// Save the PDF to a file
Pdf.SaveAs("url.pdf");
var Renderer = new IronPdf.ChromePdfRenderer();
// Render a PDF from an existing URL
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
// Save the PDF to a file
Pdf.SaveAs("url.pdf");
$vbLabelText   $csharpLabel

HTML入力文字列をPDFに変換

以下のコードは、HTML文字列からPDFドキュメントをレンダリングする方法を説明しています。 HTMLだけを使うことも、CSSや画像、JavaScriptと組み合わせて使用することもできます。

var Renderer = new IronPdf.ChromePdfRenderer();
// Render a PDF from a simple HTML string
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");

// Load external HTML assets like images, CSS, and JavaScript
// Set the optional BasePath as the file location to load assets from
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>Sample Text</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
var Renderer = new IronPdf.ChromePdfRenderer();
// Render a PDF from a simple HTML string
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");

// Load external HTML assets like images, CSS, and JavaScript
// Set the optional BasePath as the file location to load assets from
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>Sample Text</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
$vbLabelText   $csharpLabel

出力は以下の通りです。

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 4: IronPdfはURLとHTML CSS文字列からPDFを生成します。

IronPdfはURLとHTML CSS文字列からPDFを生成します。

3.2. Apitron PDF Kitを使用

Apitron PDF では、URL または HTML を PDF に変換する方法は提供されていません。 PDFをHTMLに変換することはできます。 ただし、XML ファイルを PDF に変換することも行います。 使用するXMLファイルは以下のとおりです:

<?xml version="1.0" encoding="utf-8"?>
<FlowDocument xmlns="Apitron.PDF.Kit.FlowLayout.v1">
  <Resources>
    <Image resourceId="logo" fileName="../../images/logo.png" />
  </Resources>
  <Styles>
    <Style selector="flowdocument">
      <Color value="Black" />
    </Style>
    <Style selector="grid">
      <InnerBorder thickness="1" />
      <InnerBorderColor value="Black" />
    </Style>
  </Styles>
  <Elements>
    <Image>
      <Properties>
        <Class value="logo" />
        <ResourceId value="logo" />
      </Properties>
    </Image>
    <TextBlock>
      <Properties>
        <Class value="header" />
        <Text value="Sample Interview Questions for Candidates" />
      </Properties>
    </TextBlock>
    <Br />
    <TextBlock>
      <Properties>
        <Class value="headerNote" />
        <Text value="To help facilitate the interview process, the Human Resources Department has compiled a list of questions that might be used during the phone and/or on-campus interviews. Some of the questions deal with the same content, but are phrased differently while other questions may not pertain to a specific discipline; however all of the questions are unbiased and appropriate to ask. We hope you'll find this helpful." />
      </Properties>
    </TextBlock>
  </Elements>
  <Properties>
    <Margin value="30,20,30,20" />
  </Properties>
</FlowDocument>
<?xml version="1.0" encoding="utf-8"?>
<FlowDocument xmlns="Apitron.PDF.Kit.FlowLayout.v1">
  <Resources>
    <Image resourceId="logo" fileName="../../images/logo.png" />
  </Resources>
  <Styles>
    <Style selector="flowdocument">
      <Color value="Black" />
    </Style>
    <Style selector="grid">
      <InnerBorder thickness="1" />
      <InnerBorderColor value="Black" />
    </Style>
  </Styles>
  <Elements>
    <Image>
      <Properties>
        <Class value="logo" />
        <ResourceId value="logo" />
      </Properties>
    </Image>
    <TextBlock>
      <Properties>
        <Class value="header" />
        <Text value="Sample Interview Questions for Candidates" />
      </Properties>
    </TextBlock>
    <Br />
    <TextBlock>
      <Properties>
        <Class value="headerNote" />
        <Text value="To help facilitate the interview process, the Human Resources Department has compiled a list of questions that might be used during the phone and/or on-campus interviews. Some of the questions deal with the same content, but are phrased differently while other questions may not pertain to a specific discipline; however all of the questions are unbiased and appropriate to ask. We hope you'll find this helpful." />
      </Properties>
    </TextBlock>
  </Elements>
  <Properties>
    <Margin value="30,20,30,20" />
  </Properties>
</FlowDocument>
XML

このXMLテンプレートをPDFに変換するコードは次のとおりです:

// Use Apitron's FlowDocument to convert XML to PDF
using (Stream stream = File.OpenRead("C:\PLACE YOUR EXACT PATH HERE\template.xml"), 
               outputStream = File.Create("fromTemplate.pdf"))
{
    ResourceManager resourceManager = new ResourceManager();
    FlowDocument doc = FlowDocument.LoadFromXml(stream, resourceManager);

    doc.Write(outputStream, resourceManager);
}
// Use Apitron's FlowDocument to convert XML to PDF
using (Stream stream = File.OpenRead("C:\PLACE YOUR EXACT PATH HERE\template.xml"), 
               outputStream = File.Create("fromTemplate.pdf"))
{
    ResourceManager resourceManager = new ResourceManager();
    FlowDocument doc = FlowDocument.LoadFromXml(stream, resourceManager);

    doc.Write(outputStream, resourceManager);
}
$vbLabelText   $csharpLabel

出力は以下の通りです。

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 5: アピトロンPDFドキュメント

アピトロンPDFドキュメント

IronPDFとApitronの出力を比較すると、IronPDFはHTMLレンダリングを使用し、画像サイズのスケーリングも行わずに、印象的なドキュメントを作成していることがはっきりとわかります。一方、ApitronはXMLファイルにスタイルが登録されている場合のみ、IronPDFと同様の出力を生成します。

4. PDFドキュメントにヘッダーとフッターを追加

4.1. IronPDFを使用

IronPDF を使用すると、ヘッダーとフッターの追加は簡単です。 IronPDF を使用すると、ページ番号や改ページを追加したり、表紙や余白を添付したりできます。

ヘッダーとフッターを追加するコードは次のとおりです:

var Renderer = new ChromePdfRenderer();

// Add a header
Renderer.RenderingOptions.FirstPageNumber = 1; // Use 2 if a cover page will be appended
Renderer.RenderingOptions.TextHeader.DrawDividerLine = true;
Renderer.RenderingOptions.TextHeader.CenterText = "This is the header text";
Renderer.RenderingOptions.TextHeader.Font = IronPdf.Font.FontTypes.Helvetica;
Renderer.RenderingOptions.TextHeader.FontSize = 12;
Renderer.RenderingOptions.MarginTop = 25; // Create 25mm space for header

// Add a footer too
Renderer.RenderingOptions.TextFooter.DrawDividerLine = true;
Renderer.RenderingOptions.TextFooter.Font = IronPdf.Font.FontTypes.Arial;
Renderer.RenderingOptions.TextFooter.FontSize = 12;
Renderer.RenderingOptions.TextFooter.LeftText = "{date} {time}";
Renderer.RenderingOptions.TextFooter.RightText = "{page} of {total-pages}";
Renderer.RenderingOptions.MarginTop = 25; // Create 25mm space for footer

using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>This is header and footer generated pdf file</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
var Renderer = new ChromePdfRenderer();

// Add a header
Renderer.RenderingOptions.FirstPageNumber = 1; // Use 2 if a cover page will be appended
Renderer.RenderingOptions.TextHeader.DrawDividerLine = true;
Renderer.RenderingOptions.TextHeader.CenterText = "This is the header text";
Renderer.RenderingOptions.TextHeader.Font = IronPdf.Font.FontTypes.Helvetica;
Renderer.RenderingOptions.TextHeader.FontSize = 12;
Renderer.RenderingOptions.MarginTop = 25; // Create 25mm space for header

// Add a footer too
Renderer.RenderingOptions.TextFooter.DrawDividerLine = true;
Renderer.RenderingOptions.TextFooter.Font = IronPdf.Font.FontTypes.Arial;
Renderer.RenderingOptions.TextFooter.FontSize = 12;
Renderer.RenderingOptions.TextFooter.LeftText = "{date} {time}";
Renderer.RenderingOptions.TextFooter.RightText = "{page} of {total-pages}";
Renderer.RenderingOptions.MarginTop = 25; // Create 25mm space for footer

using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>This is header and footer generated pdf file</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
$vbLabelText   $csharpLabel

出力は以下の通りです。

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 6: IronPDF ヘッダーとフッター

IronPDF ヘッダーとフッター

4.2. Apitron PDF Kitを使用

Apitron PDF Kitは、XML構造形式のコンテンツをPDFに変換してPDFを作成します。 Apitron PDF Kit では、 PageHeaderPageFooterプロパティを使用してヘッダーとフッターを追加できます。 これを行うためのコードは以下のとおりです:

// Register document resources first
ResourceManager resourceManager = new ResourceManager();
resourceManager.RegisterResource(new Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo", "../../data/logo.png"));

// Create the document
FlowDocument doc = new FlowDocument() { Margin = new Thickness(10) };

// Register styles
doc.StyleManager.RegisterStyle(".pageHeader", new Style() { Font = new Font(StandardFonts.TimesBold, 20) });
doc.StyleManager.RegisterStyle(".pageFooter", new Style() { Align = Align.Right });
doc.StyleManager.RegisterStyle("hr", new Style() { Height = 2, Margin = new Thickness(0, 5, 0, 5) });
doc.StyleManager.RegisterStyle(".content", new Style() { Align = Align.Left, Display = Display.InlineBlock });

// Fill the header section
doc.PageHeader.Class = "pageHeader";
doc.PageHeader.Add(new Image("logo") { Width = 100, Height = 50 });
doc.PageHeader.Add(new TextBlock("This document is intended for internal use only") { TextIndent = 20 });
doc.PageHeader.Add(new Hr());

// Fill the footer section
doc.PageFooter.Class = "pageFooter";
doc.PageFooter.Add(new Hr());
doc.PageFooter.Add(new TextBlock((ctx) => string.Format("Page {0} from&nbsp;", ctx.CurrentPage + 1)));
doc.PageFooter.Add(new PageCount(3) { Display = Display.Inline });

// Add pages
for (int i = 0; i < 2; ++i)
{
    doc.Add(new TextBlock("This is header and footer generation pdf file.") { Class = "content" });
    doc.Add(new PageBreak());
}

// Generate PDF
using (Stream stream = File.Create("out.pdf"))
{
    doc.Write(stream, resourceManager);
}

Process.Start("out.pdf");
// Register document resources first
ResourceManager resourceManager = new ResourceManager();
resourceManager.RegisterResource(new Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo", "../../data/logo.png"));

// Create the document
FlowDocument doc = new FlowDocument() { Margin = new Thickness(10) };

// Register styles
doc.StyleManager.RegisterStyle(".pageHeader", new Style() { Font = new Font(StandardFonts.TimesBold, 20) });
doc.StyleManager.RegisterStyle(".pageFooter", new Style() { Align = Align.Right });
doc.StyleManager.RegisterStyle("hr", new Style() { Height = 2, Margin = new Thickness(0, 5, 0, 5) });
doc.StyleManager.RegisterStyle(".content", new Style() { Align = Align.Left, Display = Display.InlineBlock });

// Fill the header section
doc.PageHeader.Class = "pageHeader";
doc.PageHeader.Add(new Image("logo") { Width = 100, Height = 50 });
doc.PageHeader.Add(new TextBlock("This document is intended for internal use only") { TextIndent = 20 });
doc.PageHeader.Add(new Hr());

// Fill the footer section
doc.PageFooter.Class = "pageFooter";
doc.PageFooter.Add(new Hr());
doc.PageFooter.Add(new TextBlock((ctx) => string.Format("Page {0} from&nbsp;", ctx.CurrentPage + 1)));
doc.PageFooter.Add(new PageCount(3) { Display = Display.Inline });

// Add pages
for (int i = 0; i < 2; ++i)
{
    doc.Add(new TextBlock("This is header and footer generation pdf file.") { Class = "content" });
    doc.Add(new PageBreak());
}

// Generate PDF
using (Stream stream = File.Create("out.pdf"))
{
    doc.Write(stream, resourceManager);
}

Process.Start("out.pdf");
$vbLabelText   $csharpLabel

出力は以下の通りです。

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 7: アピトロンのヘッダーとフッター

アピトロンのヘッダーとフッター

5. PDFにデジタル署名を追加

5.1. IronPDFを使用

PDF処理の最も重要な機能の1つは、PDFドキュメントにデジタル署名を追加する能力です。 IronPDFはこれを行うために必要なすべてのツールを提供しています。

using IronPdf;

// Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");

/***** Advanced example for more control *****/

// 1. Create a PDF
var Renderer = new IronPdf.ChromePdfRenderer();
var doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>");

// 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.

var signature = new IronPdf.Signing.PdfSignature("Iron.pfx", "123456");

// 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png");

// 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature);

// 5. The PDF is not signed until saved to file, stream or byte array.
doc.SaveAs("signed.pdf");
using IronPdf;

// Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");

/***** Advanced example for more control *****/

// 1. Create a PDF
var Renderer = new IronPdf.ChromePdfRenderer();
var doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>");

// 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.

var signature = new IronPdf.Signing.PdfSignature("Iron.pfx", "123456");

// 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png");

// 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature);

// 5. The PDF is not signed until saved to file, stream or byte array.
doc.SaveAs("signed.pdf");
$vbLabelText   $csharpLabel

5.2 Apitron PDF Kitを使用

Apitron PDF Kitを使用したPDFへの署名のスタンプは、長くて技術的なプロセスです。

static void Main(string[] args)
{
    string fileName = "signedTwice.pdf";

    using (Stream stream = File.Create(fileName))
    {
        FlowDocument doc = new FlowDocument() { Margin = new Thickness(10) };
        doc.Add(new TextBlock("Signed using Apitron PDF Kit for .NET"));
        doc.Write(stream, new ResourceManager());
    }

    // Save
    Sign(fileName, "../../data/certs/JohnDoe.pfx", "password", "../../data/images/signatureImage.png", new Boundary(10, 750, 110, 800));
}

// Implementation of Sign Method
private static void Sign(string pathToDocument, string pathToCertificate, string password, string pathToSignatureImage, Boundary signatureViewLocation)
{
    // Open existing document and sign once
    using (Stream inputStream = new FileStream(pathToDocument, FileMode.Open, FileAccess.ReadWrite))
    {
        using (FixedDocument doc = new FixedDocument(inputStream))
        {
            string imageResourceId = Guid.NewGuid().ToString("N");
            string signatureFieldId = Guid.NewGuid().ToString("N");

            // Register signature image resource
            doc.ResourceManager.RegisterResource(new Image(imageResourceId, pathToSignatureImage));

            // Create first signature field and initialize it using a stored certificate
            SignatureField signatureField = new SignatureField(signatureFieldId);
            using (Stream signatureDataStream = File.OpenRead(pathToCertificate))
            {
                signatureField.Signature = Signature.Create(new Pkcs12Store(signatureDataStream, password));
            }

            // Add signature fields to the document
doc.AcroForm.Fields.Add(signatureField);

            // Create first signature view using the image resource
            SignatureFieldView signatureView = new SignatureFieldView(signatureField, signatureViewLocation);
            signatureView.ViewSettings.Graphic = Graphic.Image;
            signatureView.ViewSettings.GraphicResourceID = imageResourceId;
            signatureView.ViewSettings.Description = Description.None;

            // Add views to page annotations collection
doc.Pages[0].Annotations.Add(signatureView);

            // Save as incremental update
doc.Save();
        }
    }
}
static void Main(string[] args)
{
    string fileName = "signedTwice.pdf";

    using (Stream stream = File.Create(fileName))
    {
        FlowDocument doc = new FlowDocument() { Margin = new Thickness(10) };
        doc.Add(new TextBlock("Signed using Apitron PDF Kit for .NET"));
        doc.Write(stream, new ResourceManager());
    }

    // Save
    Sign(fileName, "../../data/certs/JohnDoe.pfx", "password", "../../data/images/signatureImage.png", new Boundary(10, 750, 110, 800));
}

// Implementation of Sign Method
private static void Sign(string pathToDocument, string pathToCertificate, string password, string pathToSignatureImage, Boundary signatureViewLocation)
{
    // Open existing document and sign once
    using (Stream inputStream = new FileStream(pathToDocument, FileMode.Open, FileAccess.ReadWrite))
    {
        using (FixedDocument doc = new FixedDocument(inputStream))
        {
            string imageResourceId = Guid.NewGuid().ToString("N");
            string signatureFieldId = Guid.NewGuid().ToString("N");

            // Register signature image resource
            doc.ResourceManager.RegisterResource(new Image(imageResourceId, pathToSignatureImage));

            // Create first signature field and initialize it using a stored certificate
            SignatureField signatureField = new SignatureField(signatureFieldId);
            using (Stream signatureDataStream = File.OpenRead(pathToCertificate))
            {
                signatureField.Signature = Signature.Create(new Pkcs12Store(signatureDataStream, password));
            }

            // Add signature fields to the document
doc.AcroForm.Fields.Add(signatureField);

            // Create first signature view using the image resource
            SignatureFieldView signatureView = new SignatureFieldView(signatureField, signatureViewLocation);
            signatureView.ViewSettings.Graphic = Graphic.Image;
            signatureView.ViewSettings.GraphicResourceID = imageResourceId;
            signatureView.ViewSettings.Description = Description.None;

            // Add views to page annotations collection
doc.Pages[0].Annotations.Add(signatureView);

            // Save as incremental update
doc.Save();
        }
    }
}
$vbLabelText   $csharpLabel

ライブラリの出力はほぼ同じです。 IronPDFがPDFコンテンツの操作にはるかに簡単で便利であることが明らかです。 出力されたPDFは、証明書と印刷された署名で署名されています。

IronPDFを使用したBootstrap 5でのポートフォリオギャラリー

IronPDFのChrome V8レンダリングエンジンは、最新のBootstrap 5コンポーネントを完全にサポートしており、プロフェッショナルなポートフォリオギャラリーで視覚的に驚くべきPDFドキュメントを生成することができます。 この例では、グリッドレイアウト、ホバー効果、グラデーションオーバーレイ、カテゴリバッジをデモンストレーションしています - Apitron PDF SDKのような従来のPDFライブラリで実装するのが困難な機能です。

using IronPdf;

var renderer = new ChromePdfRenderer();

string portfolioGallery = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
    <style>
        .gallery-item {
            position: relative;
            overflow: hidden;
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }
        .gallery-item img {
            width: 100%;
            height: 250px;
            object-fit: cover;
            transition: transform 0.3s;
        }
        .gallery-item:hover img {
            transform: scale(1.1);
        }
        .gallery-overlay {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
            padding: 20px;
            color: white;
        }
        .category-badge {
            position: absolute;
            top: 10px;
            right: 10px;
        }
        @media print {
            .gallery-item { page-break-inside: avoid; }
        }
    </style>
</head>
<body>
    <div class='container py-5'>
        <div class='text-center mb-5'>
            <h1 class='display-4'>Design Portfolio</h1>
            <p class='lead text-muted'>Showcase of PDF Document Designs</p>
        </div>

        <div class='row mb-4'>
            <div class='col-12'>
                <div class='btn-group' role='group'>
                    <button class='btn btn-primary'>All Projects</button>
                    <button class='btn btn-outline-primary'>Invoices</button>
                    <button class='btn btn-outline-primary'>Reports</button>
                    <button class='btn btn-outline-primary'>Forms</button>
                    <button class='btn btn-outline-primary'>Certificates</button>
                </div>
            </div>
        </div>

        <div class='row g-4'>
            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-primary category-badge'>Invoice</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📄</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Professional Invoice Template</h5>
                        <small>Corporate billing with itemized details</small>
                    </div>
                </div>
            </div>

            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-success category-badge'>Report</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📊</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Analytics Dashboard Report</h5>
                        <small>Data visualization and metrics</small>
                    </div>
                </div>
            </div>

            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-warning category-badge'>Certificate</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>🏆</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Award Certificate</h5>
                        <small>Professional achievement recognition</small>
                    </div>
                </div>
            </div>

            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-info category-badge'>Form</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #fa709a 0%, #fee140 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📝</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Application Form</h5>
                        <small>Multi-page data collection</small>
                    </div>
                </div>
            </div>

            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-danger category-badge'>Invoice</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #30cfd0 0%, #330867 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>💰</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Payment Receipt</h5>
                        <small>Transaction confirmation document</small>
                    </div>
                </div>
            </div>

            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-secondary category-badge'>Report</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📈</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Financial Statement</h5>
                        <small>Quarterly performance overview</small>
                    </div>
                </div>
            </div>
        </div>

        <div class='text-center mt-5'>
            <p class='text-muted'>All templates rendered with IronPDF's Chromium engine</p>
            <div class='d-flex justify-content-center gap-2'>
                <span class='badge bg-primary'>Bootstrap 5</span>
                <span class='badge bg-success'>Responsive</span>
                <span class='badge bg-info'>Print-Ready</span>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(portfolioGallery);
pdf.SaveAs("portfolio-gallery.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();

string portfolioGallery = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
    <style>
        .gallery-item {
            position: relative;
            overflow: hidden;
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }
        .gallery-item img {
            width: 100%;
            height: 250px;
            object-fit: cover;
            transition: transform 0.3s;
        }
        .gallery-item:hover img {
            transform: scale(1.1);
        }
        .gallery-overlay {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
            padding: 20px;
            color: white;
        }
        .category-badge {
            position: absolute;
            top: 10px;
            right: 10px;
        }
        @media print {
            .gallery-item { page-break-inside: avoid; }
        }
    </style>
</head>
<body>
    <div class='container py-5'>
        <div class='text-center mb-5'>
            <h1 class='display-4'>Design Portfolio</h1>
            <p class='lead text-muted'>Showcase of PDF Document Designs</p>
        </div>

        <div class='row mb-4'>
            <div class='col-12'>
                <div class='btn-group' role='group'>
                    <button class='btn btn-primary'>All Projects</button>
                    <button class='btn btn-outline-primary'>Invoices</button>
                    <button class='btn btn-outline-primary'>Reports</button>
                    <button class='btn btn-outline-primary'>Forms</button>
                    <button class='btn btn-outline-primary'>Certificates</button>
                </div>
            </div>
        </div>

        <div class='row g-4'>
            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-primary category-badge'>Invoice</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📄</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Professional Invoice Template</h5>
                        <small>Corporate billing with itemized details</small>
                    </div>
                </div>
            </div>

            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-success category-badge'>Report</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📊</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Analytics Dashboard Report</h5>
                        <small>Data visualization and metrics</small>
                    </div>
                </div>
            </div>

            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-warning category-badge'>Certificate</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>🏆</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Award Certificate</h5>
                        <small>Professional achievement recognition</small>
                    </div>
                </div>
            </div>

            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-info category-badge'>Form</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #fa709a 0%, #fee140 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📝</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Application Form</h5>
                        <small>Multi-page data collection</small>
                    </div>
                </div>
            </div>

            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-danger category-badge'>Invoice</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #30cfd0 0%, #330867 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>💰</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Payment Receipt</h5>
                        <small>Transaction confirmation document</small>
                    </div>
                </div>
            </div>

            <div class='col-md-4'>
                <div class='gallery-item'>
                    <span class='badge bg-secondary category-badge'>Report</span>
                    <svg width='100%' height='250' style='background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)'>
                        <text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📈</text>
                    </svg>
                    <div class='gallery-overlay'>
                        <h5 class='mb-1'>Financial Statement</h5>
                        <small>Quarterly performance overview</small>
                    </div>
                </div>
            </div>
        </div>

        <div class='text-center mt-5'>
            <p class='text-muted'>All templates rendered with IronPDF's Chromium engine</p>
            <div class='d-flex justify-content-center gap-2'>
                <span class='badge bg-primary'>Bootstrap 5</span>
                <span class='badge bg-success'>Responsive</span>
                <span class='badge bg-info'>Print-Ready</span>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(portfolioGallery);
pdf.SaveAs("portfolio-gallery.pdf");
$vbLabelText   $csharpLabel

このコードは、レスポンシブグリッドレイアウト、視覚的なカテゴリバッジ、グラデーションオーバーレイ、およびホバー効果を備えたプロフェッショナルなPDFポートフォリオを生成します。 Chromeレンダリングエンジンは、すべてのBootstrapスタイリング、CSSグリッドレイアウト、およびカスタムCSSプロパティを保持します - これを従来のPDFライブラリは再現するのが難しいです。

Apitron PDF SDKに対する主な利点:

  • 変換なしでネイティブBootstrap 5のサポート
  • CSSグリッドとフレックスボックスレイアウトが完全にレンダリングされます
  • グラデーション背景と最新のCSS効果
  • より簡単なコードとより高品質な出力

Bootstrap PDF生成の完全ガイドについては、HTML to PDF Bootstrap Guideをご覧ください。

6. 価格とライセンス

IronPDFの価格とライセンス

IronPDFは開発用に無料で使用でき、商用使用にはいつでもライセンス化できます。単一の開発者、代理店、多国籍組織、SaaSおよびOEM再配布用のプロジェクトライセンスも利用可能です。 すべてのライセンスには、30日間の返金保証、1年のサポートとアップグレード、開発/ステージング/製品機能の有効性、および永続ライセンス(1回限りの購入)が提供されます。

Liteパッケージは、$799で提供され、再発費用はありません。 最良のライセンスを選択するための詳細と支援は、IronPDF製品ライセンスページで入手できます。

A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 8: IronPDF のライセンス

IronPDF のライセンス

Apitron PDF Kitの価格とライセンス

現在使用されているライセンススキームは2つあります - モダンとレガシーです。 すでにライセンスをお持ちの場合、レガシーライセンススキームはライセンスが期限切れになるまで有効です。 その後、移行のためにカスタマーサポートに連絡する必要があります。 モダンライセンススキームは、新しい顧客にだけ適用されます。

モダンスキームの下で、次の3つのライセンステイヤーがあります:

  • 評価 - 完全機能の製品を使用するための3ヶ月の評価期間。 NuGetからパッケージをダウンロードして開発を開始。
  • コミュニティ - あなたの非商用プロジェクトで無料で完全に機能する製品を使用します。 承認が必要です。
  • 商用 - 上記の記述に該当しないあらゆるユースケース。 価格は使用パターンに依存します。

結論

IronPDFライブラリは、HTML、JS、CSS、JPG、PNG、GIF、SVGなどのドキュメントタイプからピクセルパーフェクトなPDFを作成します。 Chromiumエンジンは、完璧なPDFを出力として提供するためにHTMLファイルやURLをレンダリングするのに役立ちます。

Apitronは、100% PDF仕様互換で実装された固定レイアウトAPIを使用してPDFを作成することを可能にします。 HTMLおよびCSSに似たスタイル駆動のコンテンツ生成メソッドとして、この固定レイアウトAPIは、素晴らしいレポート、請求書、カタログなどをわずか数分で作成する能力を提供します。 また、XMLテンプレートの作成もサポートしています。

Apitron PDFのライセンス価格はそのウェブサイトには掲載されていません。サポートに連絡して使用に基づいた見積もりを取得する必要があります。 一方で、IronPDFはそのウェブサイトで非常に明確なライセンスポリシーを表示しており、これによりIronPDFは競合製品より際立ち、ユーザーが自身のニーズに応じて賢く選択できるようにしています。

IronPDFを使用すると、Apitron PDFよりも簡単にPDFファイルを操作できます。 IronPDFは、挑戦的なPDFジョブに対して、ユーザーがより少ないコード行を書くことを可能にします。 IronPDFは複数のファイルタイプからPDFを生成する複数のメソッドを提供しますが、ApitronはXMLドキュメントをPDFドキュメントに変換することのみ可能です。 Apitronと比較して、IronPDFでは技術的オプションを追加することなく完璧な出力が得られます。

Iron Softwareのすべての顧客は、2つの製品の価格で同社の5つの製品すべてを購入するオプションがあります。 IronPDFの無料30日間の試用版を試して、その完全な機能をテストしてください。 Iron Software製品のフルスイートを購入する IronSoftware.comで。

Apitron PDF Kitは、各所有者の登録商標です。 このサイトはApitron PDF Kitと提携しておらず、支持またはスポンサーされていません。 すべての製品名、ロゴ、およびブランドは各所有者の所有物です。 比較は情報提供のみを目的としており、執筆時点で公開されている情報を反映しています。

よくある質問

C#でHTMLをPDFに変換する方法は?

IronPDF の RenderHtmlAsPdf メソッドを使用して、HTML 文字列を PDF に変換できます。RenderHtmlFileAsPdf を使用して HTML ファイルを PDF に変換することもできます。

IronPDFはPDF作成にどのような機能を提供していますか?

IronPDFは、HTML、CSS、およびJavaScriptからのPDF作成、URLの読み込み、テキストとグラフィックスの抽出、PDFの結合などをサポートします。これは.NET Core、Azure、AWS、Docker、Linux、Windowsと互換性があります。

C#でPDFにデジタル署名する方法は?

IronPDFでは、少ないコード行数で統合可能なPDF署名証明書を使用して、PDFにデジタル署名することができます。

IronPDFのインストールオプションにはどのようなものがありますか?

IronPDFは、NuGetパッケージマネージャー、Developer Command Promptを使用するか、NuGetパッケージまたはIronPDF .DLLライブラリを直接ダウンロードすることでインストールできます。

IronPDFには無料版がありますか?

はい、IronPDFは無料の開発版と商業ライセンスを提供しています。30日間の返金保証を含む詳細な価格情報は、彼らのウェブサイトで入手できます。

Apitron PDF KitはHTMLをPDFに変換する方法をどう取り扱っていますか?

Apitron PDF Kitは直接HTMLをPDFに変換することはサポートしていませんが、XMLファイルをPDFに変換することができます。

Apitron PDF Kitの際立った特徴は何ですか?

Apitron PDF Kitは、画像、図面、テキストの追加、ドキュメントの署名、PDFの結合や分割などの包括的なPDF操作を可能にします。ただし、直接のHTMLからPDFへの変換はできません。

C#でPDFにヘッダーとフッターを追加する方法は?

IronPDFを使用すると、AddTextHeaderAddTextFooterのようなメソッドを使用して、簡単にPDFにヘッダーとフッターを追加できます。

Apitron PDF Kitのライセンスオプションにはどのようなものがありますか?

Apitron PDF Kitは、商業用でないプロジェクト用の三ヶ月間の評価期間とコミュニティライセンスを提供しています。商業目的での使用には、直接問い合わせて見積もりをお願いする必要があります。

どのPDFライブラリが.NET開発に使いやすいですか?

IronPDFは一般的に.NET開発において使いやすく、簡単なAPIを提供しており、複雑なタスクでも少ないコード行数で対応できます。

カーティス・チャウ
テクニカルライター

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

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