PdfiumとIronPDFの比較:技術比較ガイド
.NET開発者がPDF機能を必要とする場合、GoogleのPDFiumレンダリングエンジンの.NETラッパーであるPdfium.NET(またはPdfiumViewer)に遭遇することがよくあります。この比較では、PdfiumとIronPDFを比較し、アーキテクチャの違い、機能の完全性、最新のアプリケーション要件への適合性を分析します。
Pdfiumとは何ですか?
Pdfium.NETは、もともとChromium用に開発されたGoogleのPDFiumライブラリの.NETラッパーです。 このライブラリは、.NETアプリケーションでPDFドキュメントを忠実に表示するPDFレンダリングに優れています。 PDFの表示、テキストの抽出、ページの画像へのレンダリング機能を提供します。
しかし、Pdfiumの機能は、レンダリングに特化したアーキテクチャによって基本的に制限されています。 このライブラリはPDFを表示するように設計されており、PDFを作成したり操作したりするものではありません。 このため、PDFの生成、ドキュメントのマージ、コンテンツの修正が必要なアプリケーションでは、大きなギャップが生じます。
Pdfium.NETの主な特徴は以下のとおりです:
- 表示とレンダリングに注力 PDFコンテンツを忠実に表示することに優れています。
- パフォーマンス:効率的なレンダリングのためにGoogleのPDFiumを使用しています。
- ネイティブバイナリ依存: プラットフォーム固有のPDFiumバイナリ(x86/x64)が必要です。
- 展開の複雑さ:プラットフォームごとにネイティブDLLをバンドルし、管理する必要があります。
IronPDFとは何ですか?
IronPDFは、完全なPDFライフサイクル管理を提供する.NETライブラリです。 ChromePdfRendererクラスは、最新のChromiumベースのエンジンを使ってHTML、CSS、JavaScriptからPDFを作成し、PdfDocumentクラスは広範な操作機能を提供します。
Pdfiumのレンダリングのみにフォーカスしたものとは異なり、IronPdfはPDFの作成、操作、マージ、透かし、セキュリティ、テキスト抽出を一つのライブラリ内で行います。 フルマネージドアーキテクチャにより、ネイティブバイナリの依存性が排除され、プラットフォーム間のデプロイが簡素化されます。
アーキテクチャの比較
PdfiumとIronPDFの基本的な違いは、レンダリングのみと完全なPDFソリューションというスコープにあります。
| アスペクト | Pdfium.NET | IronPDF |
|---|---|---|
| 主な焦点 | レンダリング/ビューイング | 完全なPDFソリューション |
| PDFの作成。 | ✗ | (HTML, URL, 画像) |
| PDF操作 | ✗ | マージ、分割、編集 |
| HTMLからPDFへ | ✗ | Chromium エンジン |
| ウォーターマーク。 | ✗ | ✓ |
| ヘッダー/フッター | ✗ | ✓ |
| フォーム入力 | ✗ | ✓ |
| セキュリティ。 | ✗ | ✓ |
| ネイティブの依存関係 | 必須 | なし(フルマネージド) |
| クロスプラットフォーム。 | 複雑なセットアップ | 自動翻訳 |
PDFの閲覧のみを必要とするアプリケーションには、Pdfiumで十分かもしれません。PDFの生成、操作、作成機能を必要とするアプリケーションには、IronPDFが完全なソリューションを提供します。
HTMLからPDFへの変換
HTMLからPDFへの変換は、これらのライブラリ間の基本的な能力差を示しています。
PdfiumのHTMLからPDFへのアプローチ:
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System.IO;
using System.Drawing.Printing;
// Note: PdfiumViewer is primarily for viewing/rendering PDFs, not creating them from HTML
// For HTML to PDF with Pdfium.NET, you would need additional libraries
// This example shows a limitation of Pdfium.NET
class Program
{
static void Main()
{
// Pdfium.NET does not have native HTML to PDF conversion
// You would need to use a separate library to convert HTML to PDF
// then use Pdfium for manipulation
string htmlContent = "<h1>Hello World</h1>";
// This functionality is not directly available in Pdfium.NET
Console.WriteLine("HTML to PDF conversion not natively supported in Pdfium.NET");
}
}// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System.IO;
using System.Drawing.Printing;
// Note: PdfiumViewer is primarily for viewing/rendering PDFs, not creating them from HTML
// For HTML to PDF with Pdfium.NET, you would need additional libraries
// This example shows a limitation of Pdfium.NET
class Program
{
static void Main()
{
// Pdfium.NET does not have native HTML to PDF conversion
// You would need to use a separate library to convert HTML to PDF
// then use Pdfium for manipulation
string htmlContent = "<h1>Hello World</h1>";
// This functionality is not directly available in Pdfium.NET
Console.WriteLine("HTML to PDF conversion not natively supported in Pdfium.NET");
}
}Imports PdfiumViewer
Imports System.IO
Imports System.Drawing.Printing
' Note: PdfiumViewer is primarily for viewing/rendering PDFs, not creating them from HTML
' For HTML to PDF with Pdfium.NET, you would need additional libraries
' This example shows a limitation of Pdfium.NET
Class Program
Shared Sub Main()
' Pdfium.NET does not have native HTML to PDF conversion
' You would need to use a separate library to convert HTML to PDF
' then use Pdfium for manipulation
Dim htmlContent As String = "<h1>Hello World</h1>"
' This functionality is not directly available in Pdfium.NET
Console.WriteLine("HTML to PDF conversion not natively supported in Pdfium.NET")
End Sub
End ClassIronPDFのHTMLからPDFへのアプローチ:。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string htmlContent = "<h1>Hello World</h1>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully");
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string htmlContent = "<h1>Hello World</h1>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully");
}
}Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim htmlContent As String = "<h1>Hello World</h1>"
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
pdf.SaveAs("output.pdf")
Console.WriteLine("PDF created successfully")
End Sub
End ClassPdfiumはHTMLからPDFを作成することはできません。 HTMLからPDFへの変換を必要とするアプリケーションでは、IronPdfiumを追加のライブラリと組み合わせる必要があり、複雑さと潜在的な互換性の問題が生じます。
IronPDFのChromePdfRendererは最新のChromiumエンジンを使用して、CSS3、Flexbox、Grid、JavaScriptの実行を完全にサポートしたHTMLコンテンツを変換し、ウェブコンテンツから忠実度の高いPDF出力を生成します。
PDFマージ
文書のマージは、もう1つの大きな能力ギャップを示しています。
Pdfiumマージアプローチ:
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Collections.Generic;
// Note: PdfiumViewer does not have native PDF merging functionality
// You would need to use additional libraries or implement custom logic
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
// PdfiumViewer is primarily for rendering/viewing
// PDF merging is not natively supported
// You would need to use another library like iTextSharp or PdfSharp
Console.WriteLine("PDF merging not natively supported in PdfiumViewer");
}
}// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Collections.Generic;
// Note: PdfiumViewer does not have native PDF merging functionality
// You would need to use additional libraries or implement custom logic
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
// PdfiumViewer is primarily for rendering/viewing
// PDF merging is not natively supported
// You would need to use another library like iTextSharp or PdfSharp
Console.WriteLine("PDF merging not natively supported in PdfiumViewer");
}
}Imports PdfiumViewer
Imports System
Imports System.IO
Imports System.Collections.Generic
' Note: PdfiumViewer does not have native PDF merging functionality
' You would need to use additional libraries or implement custom logic
Class Program
Shared Sub Main()
Dim pdfFiles As New List(Of String) From {
"document1.pdf",
"document2.pdf",
"document3.pdf"
}
' PdfiumViewer is primarily for rendering/viewing
' PDF merging is not natively supported
' You would need to use another library like iTextSharp or PdfSharp
Console.WriteLine("PDF merging not natively supported in PdfiumViewer")
End Sub
End ClassIronPDFマージアプローチ:。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
var pdf = PdfDocument.Merge(pdfFiles);
pdf.SaveAs("merged.pdf");
Console.WriteLine("PDFs merged successfully");
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
var pdf = PdfDocument.Merge(pdfFiles);
pdf.SaveAs("merged.pdf");
Console.WriteLine("PDFs merged successfully");
}
}Imports IronPdf
Imports System
Imports System.Collections.Generic
Module Program
Sub Main()
Dim pdfFiles As New List(Of String) From {
"document1.pdf",
"document2.pdf",
"document3.pdf"
}
Dim pdf = PdfDocument.Merge(pdfFiles)
pdf.SaveAs("merged.pdf")
Console.WriteLine("PDFs merged successfully")
End Sub
End ModulePdfiumはPDFドキュメントをマージすることができません-ライブラリはこの機能を完全に欠いています。 PDFマージが必要なアプリケーションでは、追加のライブラリが必要になり、依存関係と複雑さが増します。
IronPDFのPdfDocument.Merge()メソッドはファイルパスまたはPdfDocumentオブジェクトのリストを受け入れ、単一のメソッド呼び出しでそれらを単一のドキュメントに結合します。
テキスト抽出
テキスト抽出は、アプローチや機能は異なるものの、両方のライブラリが機能を提供する分野の1つです。
Pdfiumテキスト抽出アプローチ:
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Text;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
using (var document = PdfDocument.Load(pdfPath))
{
StringBuilder text = new StringBuilder();
for (int i = 0; i < document.PageCount; i++)
{
// Note: PdfiumViewer has limited text extraction capabilities
// Text extraction requires additional work with Pdfium.NET
string pageText = document.GetPdfText(i);
text.AppendLine(pageText);
}
Console.WriteLine(text.ToString());
}
}
}// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Text;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
using (var document = PdfDocument.Load(pdfPath))
{
StringBuilder text = new StringBuilder();
for (int i = 0; i < document.PageCount; i++)
{
// Note: PdfiumViewer has limited text extraction capabilities
// Text extraction requires additional work with Pdfium.NET
string pageText = document.GetPdfText(i);
text.AppendLine(pageText);
}
Console.WriteLine(text.ToString());
}
}
}Imports PdfiumViewer
Imports System
Imports System.IO
Imports System.Text
Module Program
Sub Main()
Dim pdfPath As String = "document.pdf"
Using document = PdfDocument.Load(pdfPath)
Dim text As New StringBuilder()
For i As Integer = 0 To document.PageCount - 1
' Note: PdfiumViewer has limited text extraction capabilities
' Text extraction requires additional work with Pdfium.NET
Dim pageText As String = document.GetPdfText(i)
text.AppendLine(pageText)
Next
Console.WriteLine(text.ToString())
End Using
End Sub
End ModuleIronPDFテキスト抽出アプローチ:。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
var pdf = PdfDocument.FromFile(pdfPath);
string text = pdf.ExtractAllText();
Console.WriteLine(text);
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
var pdf = PdfDocument.FromFile(pdfPath);
string text = pdf.ExtractAllText();
Console.WriteLine(text);
}
}Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim pdfPath As String = "document.pdf"
Dim pdf = PdfDocument.FromFile(pdfPath)
Dim text As String = pdf.ExtractAllText()
Console.WriteLine(text)
End Sub
End ClassPdfiumは、GetPdfText()によるテキスト抽出を提供するため、手作業によるページの反復とStringBuilderの連結が必要です。 ドキュメントでは、PdfiumViewerには"限定的なテキスト抽出機能"があり、追加作業が必要になる可能性があることを指摘しています。
IronPdfのExtractAllText()メソッドは一回の呼び出しですべてのページからすべてのテキストを抽出し、一般的な使用例に対してよりシンプルなAPIを提供します。 ページごとのアクセスのために、IronPdfはpdf.Pages[index].Textも提供しています。
APIマッピングリファレンス
PdfからIronPDFへの移行を検討しているチームにとって、APIマッピングを理解することは労力を見積もるのに役立ちます。
ドキュメントの読み込み
| Pdfium.NET | IronPDF |
|---|---|
PdfDocument.Load(パス)。 | PdfDocument.FromFile(パス)。 |
PdfDocument.Load(stream)を実行します。 | PdfDocument.FromStream(stream)PdfDocument.FromStream(stream) |
document.PageCount</code | document.PageCount</code |
ドキュメント.ページ[インデックス] | ドキュメント.ページ[インデックス] |
テキスト抽出
| Pdfium.NET | IronPDF |
|---|---|
document.GetPdfText(pageIndex)。 | ドキュメント.ページ[index].テキスト |
| (マニュアルループ) | document.ExtractAllText()を実行します。 |
ドキュメントの保存
| Pdfium.NET | IronPDF |
|---|---|
document.Save(パス)を実行します。 | document.SaveAs(path)を実行します。 |
| (利用できません) | document.BinaryData</code |
Pdfiumでは利用できない機能
| IronPDFの特徴 | 翻訳内容 |
|---|---|
ChromePdfRenderer.RenderHtmlAsPdf()のようになります。 | HTMLからPDFを作成 |
ChromePdfRenderer.RenderUrlAsPdf()のようにします。 | URLからPDFを作成 |
PdfDocument.Merge()を使用してください。 | 複数のPDFを結合 |
pdf.CopyPages()</code | 特定のページを抜粋 |
pdf.ApplyWatermark()</code | 透かしの追加 |
pdf.SecuritySettings</code | パスワード保護 |
pdf.SignWithDigitalSignature()を使用してください。 | デジタル署名 |
ネイティブ バイナリ依存関係
アーキテクチャ上の大きな違いは、依存関係の管理にあります。
Pdfiumのデプロイ構造:
MyApp/
├── bin/
│ ├──MyApp.dll
│ ├──Pdfium.NET.dll
│ ├── x86/
│ └── pdfium.dll
│ └── x64/
└─ pdfium.dll
ランタイム
│ ├── win-x86/native/
│ └── pdfium.dll
│ └── win-x64/native/
└─ pdfium.dllIronPDFの展開構造:。
MyApp/
├── bin/
│ ├──MyApp.dll
│ └─ IronPdf.dll # 含まれるものすべてPdfiumでは、プラットフォーム固有のネイティブバイナリをバンドルして管理する必要があります。 このため、特にクロスプラットフォームのアプリケーションやコンテナ化された環境では、デプロイが複雑になります。 各ターゲットプラットフォームには正しいネイティブDLLが必要であり、アプリケーションは実行時に適切なバージョンを正しくロードする必要があります。
IronPdfのフルマネージドアーキテクチャはこれらの懸念を払拭します。 ライブラリは依存関係を内部的に処理し、Windows、Linux、macOSへの展開を簡素化します。
機能比較の概要
PdfiumとIronPDFの違いは、基本的な閲覧だけでなく、事実上すべてのPDF操作に及びます。
| フィーチャー | Pdfium.NET | IronPDF |
|---|---|---|
| PDFを読み込む | ✓ | ✓ |
| 画像にレンダリング | ✓ | ✓ |
| テキストの抽出 | 基本 | 上級 |
| ページ情報 | ✓ | ✓ |
| HTMLから作成 | ✗ | ✓ |
| URLから作成 | ✗ | ✓ |
| PDFのマージ | ✗ | ✓ |
| PDFの分割 | ✗ | ✓ |
| 透かしの追加 | ✗ | ✓ |
| ヘッダー/フッター | ✗ | ✓ |
| フォーム入力 | ✗ | ✓ |
| デジタル署名 | ✗ | ✓ |
| パスワード保護 | ✗ | ✓ |
| ネイティブの依存関係 | 必須 | なし |
| クロスプラットフォーム | 複雑 | 自動翻訳 |
透かし、ヘッダーとフッター、またはセキュリティ設定を必要とするアプリケーションは、IronPdfiumだけでは実現できません。
チームがPdfiumからIronPDFへの移行を検討するとき
チームがIronPdfをPdfiumの代替として評価するのにはいくつかの要因があります:
PDF作成要件: PdfiumはPDFを作成できません。 HTMLテンプレート、レポート、WebコンテンツからPDFを生成する必要があるアプリケーションには、追加のライブラリが必要です。 IronPdfは最新のChromiumエンジンで完全なPDF作成を提供します。
ドキュメント操作の必要性: PdfiumはPDFコンテンツをマージ、分割、修正することはできません。 アプリケーションの成熟に伴い、要件は閲覧だけでなく、ドキュメントのアセンブリ、ページの抽出、コンテンツの修正などへと拡大することがよくあります。
デプロイの簡素化:プラットフォーム間でPDFiumのネイティブバイナリを管理することは、ビルドパイプライン、デプロイプロセス、コンテナ化に複雑さを加えます。 IronPdfのマネージドアーキテクチャはこのような複雑さを解消します。
機能拡張:閲覧から始まるアプリケーションでは、しばしば透かし、セキュリティ設定、またはフォーム入力が必要になります。 IronPDFはこれらの機能をネイティブで提供しますが、Pdfiumベースのアプリケーションにこれらの機能を追加するには追加のライブラリが必要です。
クロスプラットフォームの一貫性: Pdfiumでは、ターゲット環境ごとにプラットフォーム固有のバイナリ管理が必要です。 IronPdfのマネージドコードはWindows、Linux、macOSで一貫して動作します。
インストールの比較
Pdfiumのインストール:。
Install-Package PdfiumViewerInstall-Package PdfiumViewerPlus ネイティブバイナリの手動管理。
IronPDFのインストール:。
Install-Package IronPdfInstall-Package IronPdfIronPdfはアプリケーション起動時にライセンスキーの設定を必要とします:
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"どちらのライブラリも.NET Frameworkと最新の.NETバージョンをサポートし、.NET 10とC# 14をターゲットとするアプリケーションとの互換性を保証します。
決定する
PdfiumとIronPdfのどちらを選択するかは、アプリケーションの要件によります:
PDFの表示とレンダリングだけが必要で、PDFの作成や操作を必要とせず、ネイティブバイナリの依存関係を管理しやすく、簡単なテキスト抽出が必要な場合は、Pdfiumを検討してください。
IronPDFをご検討ください: HTMLやURLからPDFを作成する必要がある場合、PDFの操作(マージ、分割、透かし)が必要な場合、ネイティブ依存のないシンプルなデプロイが必要な場合、高度な機能(フォーム、セキュリティ、署名)が必要な場合、PDFの要件を拡張するアプリケーションを構築している場合などです。
最新のアプリケーションの多くでは、PDFを作成・操作する機能が不可欠です。 Pdfiumはレンダリングのみにフォーカスしているため、追加ライブラリのない包括的なPDFワークフローには不十分です。 IronPDFの完全なソリューションは、すべてのPDF操作に統一されたAPIを提供しながら、ライブラリの組み合わせの必要性を排除します。
IronPDFを始めよう
お客様のPDFニーズにIronPDFを評価する:
1.IronPDF NuGetパッケージをインストールしてください:IronPdfパッケージをインストールしてください。 2.作成パターンについては、HTML to PDFチュートリアルをご覧ください。 3.PDF マージ機能を使用してドキュメントをアセンブルします。 4.チュートリアルセクションで包括的な例を確認してください。
IronPDFドキュメントは、一般的なシナリオのための詳細なガイダンスを提供し、APIリファレンスは、利用可能なすべてのクラスとメソッドを文書化しています。
結論
PdfiumとIronPDFは.NET PDFエコシステムにおいて基本的に異なる目的を果たします。 PdfiumはPDFレンダリングに優れており、GoogleのPDFiumエンジンを使用してドキュメントを忠実に表示します。IronPDFは単一のライブラリで作成、操作、レンダリングをカバーする完全なPDFソリューションを提供します。
PDFの閲覧のみを必要とするアプリケーションには、Pdfiumの集中的なアプローチが適しているかもしれません。 PDFの生成、ドキュメントのマージ、透かし、その他の作成機能を必要とするアプリケーションに対して、IronPDFは追加のライブラリを必要とせず、これらの機能をネイティブで提供します。
この決定は、現在の要件だけでなく、予想されるニーズにも及びます。 アプリケーションは多くの場合、閲覧から始まりますが、作成と操作を必要とするまでに拡大します。 最初からIronPdfを選択することで、Pdfiumがもたらすネイティブのバイナリ管理の複雑さを排除しながら、これらの拡張された要件に対応する基盤を提供します。
これらのライブラリのいずれかを選択する際には、現在および予測されるPDF要件全体を評価してください。 Pdfiumはレンダリング専用であるため、アプリケーションが成熟し要件が拡大するにつれて、アーキテクチャ上の制約が明らかになります。