製品比較

IronPDFとApitron PDF Kitの比較

更新済み 12月 11, 2022
共有:

C#でPDFファイルを操作するのは、開発者にとって難しいことがあります。 異なる形式からPDFにコンテンツを変換する際には、そのようなファイルのコンテンツを作成する際に考慮すべき要素が多数あります。 オートメーションは、現在ソフトウェア開発プロセスの鍵となっています。 これらの問題は、PDF文書の読み取り、書き込み、作成、修正を支援するために設計されたライブラリの構築により解決されました。また、その属性を編集し、他の形式から変換することも可能です。

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

  • IronPDFライブラリ
  • アピトロンPDFキット

    IronPDFとApitron PDF Kitは、.NETおよび.NET Core向けのPDF操作機能を提供する2つのライブラリです。 それらの両方は、ドキュメントフィールドの変換および操作タスクに使用できます。 どちらもブックマークを作成することができます。 次の質問は、私たちの.NETプロジェクトに最適なC# PDF .NETライブラリを決めることです。 この比較記事は、これらの2つのPDFライブラリのどちらを選ぶべきかの決定を支援します。

    まず、2つのライブラリが提供するものを見てみましょう。それから、比較に移ります。

Apitron PDF Kitライブラリおよびその機能

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

このPDF SDKを使用すると、以下のことが可能になります:

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

IronPDFの主な機能

開発者、特にC#プログラマーは、IronPDF .NETライブラリを気に入るでしょう。 この素晴らしいツールを使えば、.NET Core PDF処理アプリケーションを簡単に構築できます。

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

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

IronPDFの主な特徴は次のとおりです:

  • HTML4/5、CSS、およびJavaScriptを使用してPDFドキュメントを作成
  • カスタムネットワークログイン資格情報、ユーザーエージェント、プロキシ、クッキー、HTTPヘッダー、およびフォーム変数を使用したURLの読み込み (HTMLログインフォームの背後でログインを有効にする)
  • PDFフォームフィールドの読み取りおよび記入
  • PDFからのテキストおよびグラフィックの抽出
  • 新しいHTMLコンテンツでPDFページを更新する
  • テキストベースまたはHTMLベースのヘッダーとフッターの作成
  • PDFドキュメントの内容の結合と分割
  • ASP.NET Webフォームを印刷可能な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キットのインストール

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

  4. PDFにヘッダーとフッターを作成する

  5. デジタル署名 PDF

  6. 価格とライセンス

  7. 結論

1. IronPDFのインストール

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

  1. NuGet パッケージ マネージャーの使用

  2. 開発者コマンドプロンプト

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

  4. IronPDF .DLL ライブラリをダウンロード

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をインストールすることもできます。

  • Developer Command Prompt を開きます --- 通常は Visual Studio フォルダー内にあります
  • 以下のコマンドを入力してください:
Install-Package IronPdf
  • Enterキーを押してください
  • これはパッケージをダウンロードしてインストールします。

  • プロジェクトをリロードして使用を開始してください。

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

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

  • ナビゲートして https://www.nuget.org/packages/IronPdf/
  • ダウンロードパッケージを選択
  • ダウンロードしたパッケージをダブルクリックしてください。
  • パッケージがインストールされます。

  • Visual Studio プロジェクトを再読み込みして、使用を開始してください。

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

2. Apitron PDF キットのインストール

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

  • Visual StudioでNuGetパッケージを、IronPDFの時のように開きます。
  • Apitron.PDF.Kitを検索

  • 現在のプロジェクトでインストールをクリックしてください。
    A Comparison of IronPDF with Apitron PDF SDK .NET - Figure 3: Apitron PDF Kit 検索

    Apitron PDF Kit 検索

    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;
Imports Apitron.PDF.Kit
Imports Apitron.PDF.Kit.FixedLayout.Resources
Imports Apitron.PDF.Kit.FixedLayout.Resources.Fonts
Imports Apitron.PDF.Kit.FlowLayout.Content
Imports Apitron.PDF.Kit.Styles
Imports Apitron.PDF.Kit.Styles.Appearance
Imports Font = Apitron.PDF.Kit.Styles.Text.Font
VB   C#

さて、IronPDFとApitron PDFの比較に進みましょう。

PDFドキュメントの作成

3.1. IronPDFの使用

IronPDFには、PDFを作成するための複数の方法があります。 2つの重要なものを見てみましょう。

既存のURLからPDFに変換

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

IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
Pdf.SaveAs("url.pdf");
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
Pdf.SaveAs("url.pdf");
Dim Renderer As New IronPdf.ChromePdfRenderer()
Dim Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/")
Pdf.SaveAs("url.pdf")
VB   C#

HTML入力文字列をPDFに変換

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

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

// Load external HTML assets: images, CSS and JavaScript.
// An optional BasePath 'C:\site\assets\' is set 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();
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");

// Load external HTML assets: images, CSS and JavaScript.
// An optional BasePath 'C:\site\assets\' is set 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");
Dim Renderer = New IronPdf.ChromePdfRenderer()
Dim PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
PDF.SaveAs("pixel-perfect.pdf")

' Load external HTML assets: images, CSS and JavaScript.
' An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
Dim AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>Sample Text</h1>", "C:\site\assets\")
AdvancedPDF.SaveAs("html-with-assets.pdf")
VB   C#

出力は以下の通りです:

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

このXMLテンプレートを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);
}
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);
}
Using stream As Stream = File.OpenRead("C:\PLACE YOUR EXACT PATH HERE\template.xml"), outputStream As Stream = File.Create("fromTemplate.pdf")
	Dim resourceManager As New ResourceManager()

	Dim doc As FlowDocument = FlowDocument.LoadFromXml(stream, resourceManager)

	doc.Write(outputStream, resourceManager)
End Using
VB   C#

出力は以下の通りです:

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

Apitron PDF ドキュメント

IronPDFとApitronの出力を比較すると、IronPDFはHTMLレンダリングを使用し、画像サイズをスケーリングせずに見事なドキュメントを作成することが明確にわかります。一方で、ApitronもIronPDFと同様の出力を提供しますが、これはXMLファイルにスタイルが登録されている場合に限ります。

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

アイアンPDFの使用方法

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");
Dim 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

Dim 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")
VB   C#

出力は以下の通りです:

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 Fitでは、PageHeaderおよびPageFooterプロパティを使用してヘッダーとフッターを追加できます。 これを実行するコードは次のとおりです:

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

// create 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 doc's resources first
ResourceManager resourceManager = new ResourceManager();
resourceManager.RegisterResource(new Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo","../../data/logo.png"));

// create 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 doc's resources first
Dim resourceManager As New ResourceManager()
resourceManager.RegisterResource(New Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo","../../data/logo.png"))

' create document
Dim doc As New FlowDocument() With {.Margin = New Thickness(10)}

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

' fill the header section
doc.PageHeader.Class = "pageHeader"
doc.PageHeader.Add(New Image("logo") With {
	.Width = 100,
	.Height = 50
})
doc.PageHeader.Add(New TextBlock("This document is intended for internal use only") With {.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(Function(ctx) String.Format("Page {0} from&nbsp;",ctx.CurrentPage+1)))
doc.PageFooter.Add(New PageCount(3) With {.Display = Display.Inline})

' add pages
For i As Integer = 0 To 1
	doc.Add(New TextBlock("This is header and footer generation pdf file.") With {.Class = "content"})
	doc.Add(New PageBreak())
Next i

' generate PDF
Using stream As Stream = File.Create("out.pdf")
	doc.Write(stream, resourceManager)
End Using

Process.Start("out.pdf")
VB   C#

出力は以下の通りです:

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

Apitron ヘッダーとフッター

PDFにデジタル署名する

5.1. IronPDFの使用

PDF処理機能の中で最も重要な機能の一つは、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");
Imports IronPdf

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

'''*** Advanced example for more control ****

' 1. Create a PDF
Dim Renderer = New IronPdf.ChromePdfRenderer()
Dim 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.

Dim 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")
VB   C#

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();
        }
    }
}
Shared Sub Main(ByVal args() As String)
	Dim fileName As String = "signedTwice.pdf"

	Using stream As Stream = File.Create(fileName)
		Dim doc As New FlowDocument() With {.Margin = New Thickness(10)}
		doc.Add(New TextBlock("Signed using Apitron PDF Kit for .NET"))
		doc.Write(stream,New ResourceManager())
	End Using

	' save
	Sign(fileName, "../../data/certs/JohnDoe.pfx", "password", "../../data/images/signatureImage.png", New Boundary(10, 750, 110, 800))
End Sub

' Implementation of Sign Method
Private Shared Sub Sign(ByVal pathToDocument As String, ByVal pathToCertificate As String, ByVal password As String, ByVal pathToSignatureImage As String, ByVal signatureViewLocation As Boundary)
	' open existing document and sign once
	Using inputStream As Stream = New FileStream(pathToDocument, FileMode.Open, FileAccess.ReadWrite)
		Using doc As New FixedDocument(inputStream)
			Dim imageResourceId As String = Guid.NewGuid().ToString("N")
			Dim signatureFieldId As String = 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
			Dim signatureField As New SignatureField(signatureFieldId)
			Using signatureDataStream As Stream = File.OpenRead(pathToCertificate)
				signatureField.Signature = Signature.Create(New Pkcs12Store(signatureDataStream,password))
			End Using

			' add signature fields to the document
			doc.AcroForm.Fields.Add(signatureField)

			' create first signature view using the image resource
			Dim signatureView As 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()
		End Using
	End Using
End Sub
VB   C#

出力は、ライブラリに関してほとんど同じです。 IronPDFがPDFコンテンツの操作において、より簡単で便利であることがはっきりとわかります。 出力されたPDFは、証明書と署名が印刷された状態で署名されています。

価格とライセンス

IronPDFの価格とライセンス

IronPDFは、開発用に無料で使用でき、商用利用のためにいつでもライセンスを取得できるC#ライブラリです。個別の開発者、代理店、多国籍企業、およびSaaSやOEMの再配布のためのプロジェクトライセンスがすべて利用可能です。 すべてのライセンスは、30日間の返金保証、1年間のサポートとアップグレード、開発/ステージング/プロダクション環境での有効性、および永続ライセンスを提供します。 (一回限りの購入).

Liteパッケージは、$liteLicenseで利用可能で、継続費用がかかりません。 詳細および最適なライセンスの選択に関する支援については、こちらを参照してください。 製品ライセンシングページ.

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

IronPDF ライセンシング

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

現在使用されているライセンススキームは、モダンとレガシーの2種類です。 既にライセンスをお持ちの場合、ライセンスが有効期限を迎えるまで従来のライセンススキームは引き続き有効です。 その後、移行のためにカスタマーサポートに連絡する必要があります。 最新のライセンススキームは新規顧客のみに適用されます。

現代のスキームでは、3つのライセンシングティアがあります:

  • 評価 - 完全に機能する製品を使用するための3か月の評価期間。 NuGetからパッケージをダウンロードして、開発を始めましょう。
  • コミュニティ - 非商業的なプロジェクトにおいて、完全に機能する製品を無料で使用できます。 承認が必要です。

  • Commercial(商業用) - 上記に記載されていないすべての使用ケース。 料金は使用パターンによって異なります。

    購入に関する詳細については Apitronの営業担当者に連絡する.

結論

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

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で完璧な出力が達成されます。

アイアンソフトウェアのすべての顧客は、5つの製品すべてを2つの製品の価格で購入するオプションがあります。 お試しください 無料の30日間トライアル その機能を完全にテストする。 Iron Software製品のフルスイートを購入する これ.

< 以前
Telerik HTML to PDF Generator と IronPDF の比較
次へ >
IronPDFとGroupDocsの比較 概要: IronPDFとGroupDocsは、両方ともPDF操作のための強力なツールを提供します。しかし、これらのツールにはそれぞれ異なる強みがあります。以下に、これらのツールを比較して、それぞれの特徴と利点を明確にします。 1. 機能性: IronPDFはPDFの作成、編集、変換機能に優れています。特に、HTMLからPDFへの変換や、.NET環境での利用が容易です。一方、GroupDocsはドキュメントの閲覧、注釈、比較機能に強みがあります。 2. サポートされるフォーマット: IronPDFは主にPDFへの操作に焦点を当てています。GroupDocsは、Word、Excel、PowerPointなど、多くの異なるドキュメントフォーマットをサポートします。 3. 開発環境: IronPDFは.NET、Java、Python、Node.jsなどの開発環境に対応しています。GroupDocsも多数のプラットフォームに対応していますが、特定のプラットフォームに制約があります。 4. 使いやすさ: IronPDFのシンプルで直感的なAPIは、初心者から経験豊富な開発者まで、幅広いユーザーに対応します。GroupDocsも直感的なインターフェースを提供していますが、セットアップには若干の学習曲線があります。 結論: IronPDFとGroupDocsの両方が各自のニーズに応じた優れたツールを提供しています。特定の機能や環境に依存してツールを選ぶことが重要です。初心者向けの簡便さとPDF操作に特化したい場合はIronPDFが適しています。複数のドキュメントフォーマットを扱いたい場合はGroupDocsが良い選択となるでしょう。

準備はできましたか? バージョン: 2024.9 新発売

無料のNuGetダウンロード 総ダウンロード数: 10,659,073 View Licenses >