PdfiumViewerとIronPDFの比較:技術比較ガイド
.NET開発者がWindowsフォームアプリケーションでPDF機能を必要とする場合、GoogleのPDFiumレンダリングエンジン for .NETラッパーであるPdfiumViewerに出会うことが多い。この比較では、PdfiumViewerとIronPDFを比較し、アーキテクチャの違い、機能の完全性、最新のアプリケーション要件への適合性を分析します。
PdfiumViewerとは何ですか?
PdfiumViewerは、Chromeブラウザで使用されているGoogleのPDFレンダリングエンジンであるPDFium for .NETラッパーです。 このライブラリは、Windows フォーム アプリケーション用に特別に設計された高性能な PDF レンダリングを提供し、WinForms インターフェイスに直接埋め込むことができる PdfViewer コントロールを提供します。
Apache 2.0ライセンスの下で配布されるPdfiumViewerは、費用対効果の高いPDF表示機能を提供します。 ライブラリはPDF文書の作成、編集、操作はできません。 さらに、PdfiumViewerはメンテナンス状況が不透明であるため、長期的なサポートが必要なプロダクションアプリケーションにはリスクが生じます。
PdfiumViewerの主な特徴は以下のとおりです:
- 閲覧専用: PDFコンテンツの表示専用に設計されています。
- Windowsフォーム固有: WinFormsアプリケーションに限定されます。
- オープンソース: Apache 2.0ライセンス。
- ネイティブバイナリ依存: プラットフォーム固有のPDFiumバイナリ(x86/x64)が必要です。
- 不確実なメンテナンス:限られたアップデートと不明確な長期サポート
IronPDFとは何ですか?
IronPDFは、完全なPDFライフサイクル管理を提供する.NETライブラリです。 ChromePdfRendererクラスは、最新の Chromium ベースのエンジンを使用して HTML、CSS、 JavaScriptから PDF を作成します。一方、PdfDocument クラスは、広範な操作および抽出機能を提供します。
PdfiumViewerの閲覧のみに特化した機能とは異なり、IronPdfはPDFの作成、テキスト抽出、操作、結合、透かし、セキュリティのすべてを単一のライブラリ内で処理します。 このライブラリは、コンソール、ウェブ、デスクトップアプリケーションで動作し、Windows Formsの制限をはるかに超えています。
アーキテクチャの比較
PdfiumViewerとIronPdfの基本的な違いは、閲覧のみと完全なPDFソリューションというスコープにあります。
| アスペクト | PdfiumViewer | IronPDF |
|---|---|---|
| 主な焦点 | WinFormsのPDFビューア | 完全なPDFソリューション |
| PDFの作成。 | ✗ | (HTML, URL, 画像) |
| テキスト抽出。 | ✗ | ✓ |
| PDF操作 | ✗ | マージ、分割、編集 |
| 内蔵ビューア | ✓ | ✗ (バックエンド中心) |
| プラットフォームサポート | Windowsフォームのみ | コンソール、ウェブ、デスクトップ |
| フレームワークサポート | .NET Framework | .NET Framework、Core、5以上 |
| メンテナンス | 不確実 | 活発 |
Windows FormsでPDFを表示するだけのアプリケーションなら、PdfiumViewerで十分かもしれません。PDF生成、テキスト抽出、あるいはあらゆる作成機能を必要とするアプリケーションには、IronPDFが完全なソリューションを提供します。
HTMLからPDFへの変換
HTMLからPDFへの変換は、これらのライブラリ間の基本的な能力差を示しています。
PdfiumViewerのHTMLからPDFへのアプローチ:
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System.IO;
using System.Drawing.Printing;
// PDFiumViewer is primarily a PDF viewer/renderer, not a generator
// It cannot directly convert HTML to PDF
// You would need to use another library to first create the PDF
// Then use PDFiumViewer to display it:
string htmlContent = "<h1>Hello World</h1><p>This is a test document.</p>";
// This functionality is NOT available in PDFiumViewer
// You would need a different library like wkhtmltopdf or similar
// PDFiumViewer can only open and display existing PDFs:
string existingPdfPath = "output.pdf";
using (var document = PdfDocument.Load(existingPdfPath))
{
// Can only render/display existing PDF
var image = document.Render(0, 300, 300, true);
}// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System.IO;
using System.Drawing.Printing;
// PDFiumViewer is primarily a PDF viewer/renderer, not a generator
// It cannot directly convert HTML to PDF
// You would need to use another library to first create the PDF
// Then use PDFiumViewer to display it:
string htmlContent = "<h1>Hello World</h1><p>This is a test document.</p>";
// This functionality is NOT available in PDFiumViewer
// You would need a different library like wkhtmltopdf or similar
// PDFiumViewer can only open and display existing PDFs:
string existingPdfPath = "output.pdf";
using (var document = PdfDocument.Load(existingPdfPath))
{
// Can only render/display existing PDF
var image = document.Render(0, 300, 300, true);
}IronPDFのHTMLからPDFへのアプローチ:。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
string htmlContent = "<h1>Hello World</h1><p>This is a test document.</p>";
// Create a PDF from HTML string
var renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlContent);
// Save the PDF
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully!");// NuGet: Install-Package IronPdf
using IronPdf;
using System;
string htmlContent = "<h1>Hello World</h1><p>This is a test document.</p>";
// Create a PDF from HTML string
var renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlContent);
// Save the PDF
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully!");PdfiumViewerはHTMLからPDFを作成することはできません。 ライブラリは、既存のPDFファイルを開いて表示することしかできません。 HTMLからPDFへの変換を必要とするアプリケーションは、IronPdfiumViewerと追加のライブラリを組み合わせる必要があり、複雑さと潜在的な互換性の問題が生じます。
IronPDF の ChromePdfRenderer は、最新の Chromium エンジンを使用して、CSS3、Flexbox、Grid、 JavaScript実行を完全にサポートした HTML コンテンツを変換し、Web コンテンツから忠実度の高い PDF 出力を生成します。
テキスト抽出
テキスト抽出は、これらのライブラリ間のもう1つの大きな能力差を示しています。
PdfiumViewerのテキスト抽出アプローチ:
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.Text;
string pdfPath = "document.pdf";
// PDFiumViewer has limited text extraction capabilities
// It's primarily designed for rendering, not text extraction
using (var document = PdfDocument.Load(pdfPath))
{
int pageCount = document.PageCount;
Console.WriteLine($"Total pages: {pageCount}");
// PDFiumViewer does not have built-in text extraction
// You would need to use OCR or another library
// It can only render pages as images
for (int i = 0; i < pageCount; i++)
{
var pageImage = document.Render(i, 96, 96, false);
Console.WriteLine($"Rendered page {i + 1}");
}
}// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.Text;
string pdfPath = "document.pdf";
// PDFiumViewer has limited text extraction capabilities
// It's primarily designed for rendering, not text extraction
using (var document = PdfDocument.Load(pdfPath))
{
int pageCount = document.PageCount;
Console.WriteLine($"Total pages: {pageCount}");
// PDFiumViewer does not have built-in text extraction
// You would need to use OCR or another library
// It can only render pages as images
for (int i = 0; i < pageCount; i++)
{
var pageImage = document.Render(i, 96, 96, false);
Console.WriteLine($"Rendered page {i + 1}");
}
}IronPDFテキスト抽出アプローチ:。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
string pdfPath = "document.pdf";
// Open and extract text from PDF
PdfDocument pdf = PdfDocument.FromFile(pdfPath);
// Extract text from all pages
string allText = pdf.ExtractAllText();
Console.WriteLine("Extracted Text:");
Console.WriteLine(allText);
// Extract text from specific page
string pageText = pdf.ExtractTextFromPage(0);
Console.WriteLine($"\nFirst page text: {pageText}");
Console.WriteLine($"\nTotal pages: {pdf.PageCount}");// NuGet: Install-Package IronPdf
using IronPdf;
using System;
string pdfPath = "document.pdf";
// Open and extract text from PDF
PdfDocument pdf = PdfDocument.FromFile(pdfPath);
// Extract text from all pages
string allText = pdf.ExtractAllText();
Console.WriteLine("Extracted Text:");
Console.WriteLine(allText);
// Extract text from specific page
string pageText = pdf.ExtractTextFromPage(0);
Console.WriteLine($"\nFirst page text: {pageText}");
Console.WriteLine($"\nTotal pages: {pdf.PageCount}");PdfiumViewerは、テキスト抽出ではなく、主にレンダリングのために設計されています。 ドキュメントには、"組み込みのテキスト抽出機能はありません"と明記されており、OCRまたは別のライブラリを使用する必要があります。 ライブラリは、ページを画像としてのみレンダリングできます。
IronPDF の ExtractAllText() メソッドは、1 回の呼び出しですべてのページからすべてのテキストを抽出します。 よりきめ細かな制御を行うために、ExtractTextFromPage() は特定のページからのテキストを提供します。 このネイティブテキスト抽出機能により、OCRや追加ライブラリが不要になります。
PDFから画像への変換
PDFから画像へのレンダリングは、PdfiumViewerが得意とする分野の1つであり、レンダリングエンジンとしての最大の強みです。
PdfiumViewerのPDFから画像へのアプローチ:。
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.Drawing;
using System.Drawing.Imaging;
string pdfPath = "document.pdf";
string outputImage = "page1.png";
// PDFiumViewer excels at rendering PDFs to images
using (var document = PdfDocument.Load(pdfPath))
{
// Render first page at 300 DPI
int dpi = 300;
using (var image = document.Render(0, dpi, dpi, true))
{
// Save as PNG
image.Save(outputImage, ImageFormat.Png);
Console.WriteLine($"Page rendered to {outputImage}");
}
// Render all pages
for (int i = 0; i < document.PageCount; i++)
{
using (var pageImage = document.Render(i, 150, 150, true))
{
pageImage.Save($"page_{i + 1}.png", ImageFormat.Png);
}
}
}// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.Drawing;
using System.Drawing.Imaging;
string pdfPath = "document.pdf";
string outputImage = "page1.png";
// PDFiumViewer excels at rendering PDFs to images
using (var document = PdfDocument.Load(pdfPath))
{
// Render first page at 300 DPI
int dpi = 300;
using (var image = document.Render(0, dpi, dpi, true))
{
// Save as PNG
image.Save(outputImage, ImageFormat.Png);
Console.WriteLine($"Page rendered to {outputImage}");
}
// Render all pages
for (int i = 0; i < document.PageCount; i++)
{
using (var pageImage = document.Render(i, 150, 150, true))
{
pageImage.Save($"page_{i + 1}.png", ImageFormat.Png);
}
}
}IronPDF PDFから画像へのアプローチ:。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Linq;
string pdfPath = "document.pdf";
string outputImage = "page1.png";
// Open PDF and convert to images
PdfDocument pdf = PdfDocument.FromFile(pdfPath);
// Convert first page to image
var firstPageImage = pdf.ToBitmap(0);
firstPageImage[0].Save(outputImage);
Console.WriteLine($"Page rendered to {outputImage}");
// Convert all pages to images
var allPageImages = pdf.ToBitmap();
for (int i = 0; i < allPageImages.Length; i++)
{
allPageImages[i].Save($"page_{i + 1}.png");
Console.WriteLine($"Saved page {i + 1}");
}
Console.WriteLine($"Total pages converted: {pdf.PageCount}");// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Linq;
string pdfPath = "document.pdf";
string outputImage = "page1.png";
// Open PDF and convert to images
PdfDocument pdf = PdfDocument.FromFile(pdfPath);
// Convert first page to image
var firstPageImage = pdf.ToBitmap(0);
firstPageImage[0].Save(outputImage);
Console.WriteLine($"Page rendered to {outputImage}");
// Convert all pages to images
var allPageImages = pdf.ToBitmap();
for (int i = 0; i < allPageImages.Length; i++)
{
allPageImages[i].Save($"page_{i + 1}.png");
Console.WriteLine($"Saved page {i + 1}");
}
Console.WriteLine($"Total pages converted: {pdf.PageCount}");PdfiumViewer の Render() メソッドは、出力品質を細かく制御できる DPI ベースのレンダリングを提供します。 この方法では、ネストされた using ステートメントを含む手動の廃棄パターンが必要です。
IronPDF の ToBitmap() メソッドは、保存または処理できるビットマップ配列を返す、よりシンプルな API を提供します。 APIパターンは異なりますが、どちらのライブラリもこのタスクを効果的に処理します。
APIマッピングリファレンス
PdfiumViewerからIronPdfへの移行を検討しているチームにとって、APIマッピングを理解することは労力を見積もるのに役立ちます。
ドキュメントの読み込み
| PdfiumViewer | IronPDF |
|---|---|
PdfDocument.Load(path) | PdfDocument.FromFile(path) |
PdfDocument.Load(stream) | PdfDocument.FromStream(stream) |
document.PageCount | document.PageCount |
document.PageSizes[index] | document.Pages[index].Width/Height |
レンダリング
| PdfiumViewer | IronPDF |
|---|---|
document.Render(index, dpiX, dpiY, flag) | pdf.ToBitmap(index) |
document.Render(index, width, height, dpiX, dpiY, flags) | pdf.RasterizeToImageFiles(path, dpi) |
PdfiumViewerで利用できない機能
| IronPDFの特徴 | 翻訳内容 |
|---|---|
ChromePdfRenderer.RenderHtmlAsPdf() | HTMLからPDFを作成 |
ChromePdfRenderer.RenderUrlAsPdf() | URLからPDFを作成 |
pdf.ExtractAllText() | すべてのテキストを抽出 |
pdf.ExtractTextFromPage(index) | 特定のページからテキストを抽出 |
PdfDocument.Merge() | 複数のPDFを結合 |
pdf.ApplyWatermark() | 透かしの追加 |
pdf.SecuritySettings | パスワード保護 |
ネイティブ バイナリ依存関係
アーキテクチャ上の大きな違いは、依存関係の管理にあります。
PdfiumViewerの展開構造:
MyApp/
├── ビン/
│ ├──MyApp.dll
│ ├──PdfiumViewer.dll
│ ├── x86/
│ └── pdfium.dll
│ └── x64/
└─ pdfium.dllIronPDFの展開構造:。
MyApp/
├── ビン/
│ ├──MyApp.dll
│ └─ IronPdf.dll # 含まれるものすべてPdfiumViewerは、プラットフォーム固有のネイティブバイナリをバンドルし、管理する必要があります。 このため、特に複数のプラットフォームを対象とするアプリケーションでは、展開が複雑になります。 各ターゲット環境は正しいネイティブDLLを必要とし、アプリケーションは実行時に適切なバージョンを正しくロードする必要があります。
IronPdfのフルマネージドアーキテクチャはこれらの懸念を払拭します。 ライブラリは依存関係を内部的に処理し、デプロイを簡素化します。
機能比較の概要
PdfiumViewerとIronPdfの違いは、基本的な閲覧にとどまらず、事実上すべてのPDF操作に及びます。
| フィーチャー | PdfiumViewer | IronPDF |
|---|---|---|
| PDFを読み込む | ✓ | ✓ |
| 画像にレンダリング | ✓ | ✓ |
| 内蔵ビューア | ✓ | ✗ |
| 印刷用PDF | ✓ | ✓ |
| テキストの抽出 | ✗ | ✓ |
| HTMLから作成 | ✗ | ✓ |
| URLから作成 | ✗ | ✓ |
| PDFのマージ | ✗ | ✓ |
| PDFの分割 | ✗ | ✓ |
| 透かしの追加 | ✗ | ✓ |
| ヘッダー/フッター | ✗ | ✓ |
| パスワード保護 | ✗ | ✓ |
| WinFormsサポート | ✓ | ✓ |
| ASP.NETサポート | ✗ | ✓ |
| .NET Coreサポート | 制限的 | ✓ |
| アクティブメンテナンス | 不確実 | ✓ |
テキスト抽出、IronPDFマージ、透かし処理を必要とするアプリケーションは、PdfiumViewerだけでは実現できません。
組み込みビューアに関する考察
PdfiumViewer が優れている点の 1 つは、Windows フォーム アプリケーション用の組み込みの PdfViewer コントロールです。 IronPDFはバックエンドに特化しており、ビューアコントロールは含まれていません。
PdfiumViewerから移行するアプリケーションでPDFの閲覧が必要な場合、次のような選択肢があります:
-デフォルトのシステムビューア:ユーザーのデフォルトの PDF アプリケーションで PDF を開くには、Process.Start() を使用します。
- WebBrowserコントロール: WinFormsのWebBrowserコントロールでPDFを表示します(PDFプラグインが必要です)。
- サードパーティ製ビューア: Syncfusion、DevExpress、Telerikなどのベンダーが提供する特殊なビューアコントロールです。
- ウェブベースの表示:ウェブアプリケーションの場合、PDFを提供し、ブラウザに表示させます。
// Open in default PDF viewer
Process.Start(new ProcessStartInfo(pdfPath) { UseShellExecute = true });// Open in default PDF viewer
Process.Start(new ProcessStartInfo(pdfPath) { UseShellExecute = true });チームがPdfiumViewerからIronPDFへの移行を検討するとき
チームがIronPdfをPdfiumViewerの代替として評価するのにはいくつかの要因があります:
PDF作成要件: PdfiumViewerはPDFを作成できません。 HTMLテンプレート、レポート、WebコンテンツからPDFを生成する必要があるアプリケーションには、追加のライブラリが必要です。 IronPdfは最新のChromiumエンジンで完全なPDF作成を提供します。
テキスト抽出の必要性: PdfiumViewerはPDFからテキストを抽出することができません。 テキスト検索、インデックス作成、コンテンツ分析を必要とするアプリケーションには、IronPDFのネイティブテキスト抽出機能が必要です。
プラットフォーム展開: PdfiumViewerはWindowsフォームアプリケーションに制限されています。 ASP.NETウェブアプリケーション、コンソールユーティリティ、クロスプラットフォームソリューションを構築する組織はIronPDFの幅広いプラットフォームサポートを必要としています。
メンテナンスに関する懸念: PdfiumViewerの不確かなメンテナンス状況は、長期的なサポートを必要とするプロダクションアプリケーションのリスクを生み出します。 IronPDFは積極的な開発とプロフェッショナルなサポートを提供します。
機能の拡張: アプリケーションが成熟するにつれて、要件は閲覧だけでなく、ドキュメントのマージ、透かし、セキュリティ設定などにも拡張されることがよくあります。 IronPDFはこれらの機能をネイティブで提供します。
インストールの比較
PdfiumViewerのインストール:
Install-Package PdfiumViewer
Install-Package PdfiumViewer.Native.x86.v8-xfa
Install-Package PdfiumViewer.Native.x64.v8-xfaInstall-Package PdfiumViewer
Install-Package PdfiumViewer.Native.x86.v8-xfa
Install-Package PdfiumViewer.Native.x64.v8-xfaPlusネイティブのバイナリ管理。
IronPDFのインストール:。
Install-Package IronPdfInstall-Package IronPdfIronPdfはアプリケーション起動時にライセンスキーの設定を必要とします:
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";どちらのライブラリも.NET Frameworkをサポートしており、IronPDFは.NET Core、.NET 5+、そして.NET 10とC# 14もサポートしています。
決定する
PdfiumViewerとIronPDFのどちらを選ぶかはアプリケーションの要件によります:
もしWindows FormsでPDFを表示することだけが必要で、PDFの作成やテキスト抽出は必要なく、無料のオープンソースのソリューションが必要で、長期的なメンテナンスが不確実でも構わないのであれば、PdfiumViewerを検討してみてください。
IronPDFをご検討ください: HTMLやURLからPDFを作成する必要がある場合、テキスト抽出機能が必要な場合、Windowsフォームを超えるサポートが必要な場合、PDF操作(マージ、分割、透かし)が必要な場合、アクティブなメンテナンスとサポートが必要な場合、PDFの要件を拡張するアプリケーションを構築している場合などです。
ほとんどの最新のアプリケーションでは、PDFを作成、抽出、操作する機能が不可欠です。 PdfiumViewerは閲覧のみにフォーカスしているため、追加ライブラリのない包括的なPDFワークフローには不十分です。 IronPDFの完全なソリューションは、すべてのPDF操作に統一されたAPIを提供しながら、ライブラリの組み合わせの必要性を排除します。
IronPDFを始めよう
お客様のPDFニーズにIronPDFを評価する:
- IronPDF NuGetパッケージをインストールします:
Install-Package IronPdf2.作成パターンについては、HTML to PDFチュートリアルをご覧ください。 3.コンテンツ処理のためのテキスト抽出機能を探る 4.チュートリアルセクションで包括的な例を確認してください。
IronPDFドキュメントは、一般的なシナリオのための詳細なガイダンスを提供し、APIリファレンスは、利用可能なすべてのクラスとメソッドを文書化しています。
結論
PdfiumViewerとIronPDFは.NET PDFエコシステムにおいて基本的に異なる目的を果たします。 PdfiumViewerはWindowsフォームアプリケーションでのPDF表示に優れており、GoogleのPDFiumエンジンを使ってドキュメントを忠実に表示します。IronPDFは単一のライブラリで作成、テキスト抽出、操作、レンダリングをカバーする完全なPDFソリューションを提供します。
Windows FormsでPDFを表示することだけを必要とするアプリケーションには、PdfiumViewerの焦点を絞ったアプローチが適切かもしれません。 PDF生成、テキスト抽出、ドキュメントマージ、その他の作成機能を必要とするアプリケーションに対して、IronPDFは追加のライブラリを必要とせず、これらの機能をネイティブに提供します。
この決定は、現在の要件だけでなく、予想されるニーズやメンテナンスの考慮事項にも及びます。 PdfiumViewerのメンテナンス状況が不明確なため、プロジェクトのリスクが生じます。また、アプリケーションは、閲覧から始まり、作成や操作を必要とするまでに拡張することがよくあります。 当初からIronPDFを選択することで、長期的なサポートと積極的な開発を保証しながら、これらの拡張要件に対応する基盤を提供します。
これらのライブラリのいずれかを選択する際には、現在および予測されるPDF要件全体を評価してください。 PdfiumViewerの表示のみの性質は、アプリケーションが成熟し、要件が拡大するにつれて明らかになるアーキテクチャ上の制約を生み出します。
