フッターコンテンツにスキップ
移行ガイド

C#でPdfiumViewerからIronPDFに移行する方法

PdfiumViewerからIronPDFへの移行:完全なC#移行ガイド

PdfiumViewerからIronPDFへの移行は、あなたの.NET PDFワークフローを、ネイティブバイナリ依存のWindowsフォーム表示専用ライブラリから、すべての.NETアプリケーションタイプで作成、操作、テキスト抽出、レンダリングを処理する包括的なPDFソリューションに移行します。このガイドでは、PdfiumViewerでは提供できない機能を追加しながら、プラットフォームの制限をなくす完全な移行パスをステップバイステップで提供します。

なぜPdfiumViewerからIronPDFに移行するのか

PdfiumViewerを理解する

PdfiumViewerは、Chromeブラウザで使用されているGoogleのPDFレンダリングエンジンであるPDFiumの.NETラッパーです。 Windows Formsアプリケーションに直接PDF表示を統合し、高性能で忠実度の高いPDFレンダリング機能を提供する、シンプルかつ強力なソリューションを提供します。

ただし、PdfiumViewerはあくまでもビューアであることを忘れてはなりません。 PDFの作成、編集、操作には対応していないため、閲覧機能以上のものを必要とするアプリケーションには制限があるかもしれません。 さらに、メンテナンス状況が不明確であるため、プロダクションアプリケーションのリスクが生じます。

PdfiumViewerの重要な制限事項

1.閲覧のみの機能:HTML、画像、プログラムからPDFを作成することはできません。 PdfiumViewerの機能はPDFの閲覧に限定されており、IronPDFのようなライブラリとは異なり、PDFの作成、編集、結合、その他の操作機能はサポートしていません。

2.Windows Forms Specific: ライブラリは Windows Forms アプリケーションに焦点を当てており、他のユーザーインターフェイスフレームワークのサポートは提供していません。

3.PDFの操作はできません:PDFコンテンツの結合、分割、変更はできません。

4.ネイティブバイナリ依存:プラットフォーム固有のPDFiumバイナリ(x86およびx64 pdfium.dllファイル)が必要です。

5.不確かなメンテナンス:限られたアップデートと不明確な長期サポート。

6.テキスト抽出は行いません:PdfiumViewerはテキスト抽出機能を内蔵していませんので、OCRまたは別のライブラリを使用する必要があります。 ページを画像としてレンダリングすることしかできません。

7.HTMLからPDFへはありません:PdfiumViewerは主にPDFビューア/レンダラーであり、ジェネレーターではありません。 HTMLを直接PDFに変換することはできません。 wkhtmltopdfなどの別のライブラリを使用する必要があります。

8.ヘッダー/フッターなし:ページ番号や繰り返しのコンテンツを追加することはできません。

9.透かしなし:オーバーレイで文書にスタンプを押すことはできません。

10.セキュリティ機能はありません:PDFの暗号化やパスワード保護はできません。

PdfiumViewerとIronPdfの比較

アスペクトPdfiumViewerIronPDF
主な焦点WinFormsのPDFビューア完全なPDFソリューション
ライセンスアパッチ2.0商用
PDFの作成(HTML, URL, 画像)
PDF操作マージ、分割、編集
HTMLからPDFへChromium エンジン
テキスト抽出
ウォーターマーク
ヘッダー/フッター
セキュリティ
内蔵ビューア✗ (バックエンド中心)
プラットフォームサポートWindowsフォームのみコンソール、ウェブ、デスクトップ
フレームワークサポート.NET フレームワーク.NET Framework、Core、5以上
メンテナンス不確実活発

2025年と2026年まで.NET 10とC# 14の採用を計画しているチームにとって、IronPDFはWindowsフォームの制限とネイティブバイナリの複雑さを排除し、すべての.NETアプリケーションタイプで動作する包括的でアクティブにメンテナンスされた基盤を提供します。


始める前に

前提条件

1..NET環境:.NET フレームワーク4.6.2+ または .NET Core 3.1+ / .NET 5/6/7/8/9+. 2.NuGetアクセス:NuGetパッケージをインストールする能力。 3.IronPDFライセンスironPdf.comからライセンスキーを取得してください。

NuGetパッケージの変更

# RemovePdfiumViewerpackages
dotnet remove package PdfiumViewer
dotnet remove package PdfiumViewer.Native.x86.v8-xfa
dotnet remove package PdfiumViewer.Native.x64.v8-xfa

# Install IronPDF
dotnet add package IronPdf
# RemovePdfiumViewerpackages
dotnet remove package PdfiumViewer
dotnet remove package PdfiumViewer.Native.x86.v8-xfa
dotnet remove package PdfiumViewer.Native.x64.v8-xfa

# Install IronPDF
dotnet add package IronPdf
SHELL

ライセンス構成

// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

PdfiumViewerの使用法を特定する

# FindPdfiumViewerusage
grep -r "PdfiumViewer\|PdfViewer\|PdfDocument\.Load" --include="*.cs" .

# Find native binary references
grep -r "pdfium\.dll\|Native\.x86\|Native\.x64" --include="*.csproj" .

# Find viewer control usage
grep -r "PdfViewer" --include="*.cs" --include="*.Designer.cs" .
# FindPdfiumViewerusage
grep -r "PdfiumViewer\|PdfViewer\|PdfDocument\.Load" --include="*.cs" .

# Find native binary references
grep -r "pdfium\.dll\|Native\.x86\|Native\.x64" --include="*.csproj" .

# Find viewer control usage
grep -r "PdfViewer" --include="*.cs" --include="*.Designer.cs" .
SHELL

完全な API リファレンス

名前空間の変更

// PdfiumViewer
using PdfiumViewer;

// IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Editing;
// PdfiumViewer
using PdfiumViewer;

// IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Editing;
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

コア クラス マッピング

PdfiumViewerIronPDFノート
<コード>PdfDocument</コード<コード>PdfDocument</コード同じ名前、異なる機能
<コード>PdfViewer</コード(同等のものはありません)_IronPDFはバックエンドに特化しています。
<コード>PdfRenderer</コード<コード>ChromePdfRenderer</コードPDF作成
(利用できません)<コード>HtmlHeaderFooter</コードヘッダー/フッター

ドキュメント読み込みマッピング

PdfiumViewerIronPDFノート
PdfDocument.Load(パス)PdfDocument.FromFile(パス)ファイルから読み込む
PdfDocument.Load(stream)を実行します。<コード>PdfDocument.FromStream(stream)</コード><コード>PdfDocument.FromStream(stream)ストリームから読み込む
PdfDocument.Load(bytes).<コード>PdfDocument.FromBinaryData(bytes)</コード><コード>PdfDocument.FromBinaryData(bytes)バイトから読み込む

ドキュメント プロパティのマッピング

PdfiumViewerIronPDFノート
<コード>document.PageCount</コード<コード>document.PageCount</コード同じ
<コード>ドキュメント.ページサイズ</コードdocument.Pages[i].Width/Heightページごとのアクセス
document.GetPageSize(インデックス)document.Pages[index].Width/Height直接プロパティ

ページ レンダリング マッピング

PdfiumViewerIronPDFノート
document.Render(pageIndex, dpiX, dpiY, forPrinting).pdf.ToBitmap(pageIndex)のようにします。ビットマップ配列を返します。
document.Render(pageIndex, width, height, dpiX, dpiY, flags).pdf.RasterizeToImageFiles(path, dpi).バッチレンダー

ドキュメント マッピングの保存

PdfiumViewerIronPDFノート
document.Save(パス)を実行します。pdf.SaveAs(path)のようにします。異なるメソッド名
document.Save(stream)を実行します。<コード>pdf.Stream</コードアクセスストリーム
(利用できません)<コード>pdf.BinaryData</コードバイト

PdfiumViewerでは利用できない新機能

IronPDFの特徴翻訳内容
pdf.ExtractAllText()を使用してください。全ページからテキストを抽出
pdf.ExtractTextFromPage(index)のようにします。特定のページからテキストを抽出
ChromePdfRenderer.RenderHtmlAsPdf()のようになります。HTMLから作成
ChromePdfRenderer.RenderUrlAsPdf()のようにします。URLから作成
PdfDocument.Merge()を使用してください。PDFの結合
<コード>pdf.CopyPages()</コードページの抜粋
<コード>pdf.RemovePages()</コード></コードページの削除
<コード>pdf.ApplyWatermark()</コード></コード透かしの追加
<コード>pdf.AddHtmlHeaders()</コード></コードヘッダーの追加
<コード>pdf.AddHtmlFooters()</コード></コードフッターの追加
<コード>pdf.SecuritySettings</コードパスワード保護
<コード>pdf.Form</コードフォーム入力

コード移行の例

例1: PDFからのテキスト抽出

翻訳前 (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}");
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

翻訳後(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}");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

この例は、基本的な能力のギャップを浮き彫りにしています。PdfiumViewerは、"組み込みのテキスト抽出機能はありません""OCRか他のライブラリを使用する必要があります"と明言しています。 PdfiumViewerでPDFからテキストが必要な場合、画像にレンダリングしてOCRを実行せざるを得ません。

IronPDFはExtractAllText()でドキュメント全体の、またはExtractTextFromPage(index)で特定のページのネイティブテキスト抽出を提供します。 OCRも回避策もなく、PDFコンテンツから直接テキストを抽出します。 その他のオプションについては、テキスト抽出ドキュメントを参照してください。

例2: HTMLからPDFへの変換

翻訳前 (PdfiumViewer):

// 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);
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

翻訳後(IronPDF):

// 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!");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

この例は、2つのライブラリの最も重要な機能の違いを示しています。 PdfiumViewerは"この機能はPDFiumViewerでは利用できません""wkhtmltopdfなどの別のライブラリが必要です"と明示しています。

IronPDFはChromePdfRendererを通してネイティブのHTMLからPDFへの変換を提供し、HTML、CSS、JavaScriptの正確なレンダリングのために内部でChromiumエンジンを使用しています。 RenderHtmlAsPdf()メソッドは、HTML文字列を直接PDF文書に変換します。 IronPDFはRenderUrlAsPdf()でURLを、RenderHtmlFileAsPdf()でHTMLファイルをレンダリングすることもできます。 包括的な例については、HTML to PDF documentationを参照してください。

例3: PDFから画像への変換

翻訳前 (PdfiumViewer):

// 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);
        }
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

翻訳後(IronPDF):

// 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}");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

これは、PdfiumViewerが得意とする分野です。画像へのPDFレンダリングは、PdfiumViewerの最大の強みです。 どちらのライブラリもこのタスクを効果的に処理しますが、パターンは異なります。

PdfiumViewerは、document.Render(pageIndex, dpiX, dpiY, forPrinting)を使用し、適切な処理のためにusingステートメントをネストしています。 ImageFormat列式のために、System.DrawingSystem.Drawing.Imagingをインポートする必要があります。

IronPdfはビットマップ配列を返すpdf.ToBitmap(pageIndex)を使用します。 ネストされた廃棄要件はなく、よりシンプルなパターンです。 バッチ操作では、パラメータなしのToBitmap()はすべてのページを返します。 RasterizeToImageFiles()を使用して、直接ファイル出力することもできます。 その他のレンダリングオプションについては、PDF to image documentationを参照してください。


ネイティブ依存性の除去

PdfiumViewerからIronPdfへの移行の大きな利点のひとつは、ネイティブのバイナリ管理が不要になることです。

ビフォア (PdfiumViewer) - 複雑なデプロイ

MyApp/
├── bin/
│ ├──MyApp.dll
│ ├──PdfiumViewer.dll
│ ├── x86/
│ └── pdfium.dll
│ └── x64/
└─ pdfium.dll

翻訳後 (IronPDF) - クリーンなデプロイメント

MyApp/
├── bin/
│ ├──MyApp.dll
│ └─ IronPdf.dll # 含まれるものすべて

ネイティブ バイナリ参照の削除

# Delete native PDFium binaries
rm -rf x86/ x64/ runtimes/

# Remove from .csproj native package references
# <PackageReference Include="PdfiumViewer.Native.x86.v8-xfa" />
# <PackageReference Include="PdfiumViewer.Native.x64.v8-xfa" />
# Delete native PDFium binaries
rm -rf x86/ x64/ runtimes/

# Remove from .csproj native package references
# <PackageReference Include="PdfiumViewer.Native.x86.v8-xfa" />
# <PackageReference Include="PdfiumViewer.Native.x64.v8-xfa" />
SHELL

重要な移行に関する注意事項

組み込みのビューア コントロールはありません。

IronPDFはバックエンドに特化しており、ビジュアルPDFビューアコントロールは含まれていません:

// PdfiumViewer: Built-in viewer control
pdfViewer.Document = document;

// IronPDF: Use external viewer or web-based approach
pdf.SaveAs(tempPath);
Process.Start(new ProcessStartInfo(tempPath) { UseShellExecute = true });
// PdfiumViewer: Built-in viewer control
pdfViewer.Document = document;

// IronPDF: Use external viewer or web-based approach
pdf.SaveAs(tempPath);
Process.Start(new ProcessStartInfo(tempPath) { UseShellExecute = true });
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

閲覧のニーズに対しては、デフォルトのPDFビューアで開くためにProcess.Start()を使用すること、PDFパスを持つWebBrowserコントロール、またはSyncfusion、DevExpress、Telerikのようなサードパーティのビューアコントロールを使用することを検討してください。

ドキュメント読み込み方法の変更

// PdfiumViewer
PdfDocument.Load(path)

// IronPDF
PdfDocument.FromFile(path)
// PdfiumViewer
PdfDocument.Load(path)

// IronPDF
PdfDocument.FromFile(path)
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

保存メソッドの変更

// PdfiumViewer
document.Save(path)

// IronPDF
pdf.SaveAs(path)
// PdfiumViewer
document.Save(path)

// IronPDF
pdf.SaveAs(path)
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

レンダー メソッドの変更

// PdfiumViewer: Returns image with nested using
using (var image = document.Render(0, 150, 150, true))
{
    image.Save("page.png", ImageFormat.Png);
}

// IronPDF: Returns bitmap array
var images = pdf.ToBitmap(0);
images[0].Save("page.png");
// PdfiumViewer: Returns image with nested using
using (var image = document.Render(0, 150, 150, true))
{
    image.Save("page.png", ImageFormat.Png);
}

// IronPDF: Returns bitmap array
var images = pdf.ToBitmap(0);
images[0].Save("page.png");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

ページ サイズ アクセス変更

// PdfiumViewer
var size = document.PageSizes[index];
Console.WriteLine($"{size.Width} x {size.Height}");

// IronPDF
var page = pdf.Pages[index];
Console.WriteLine($"{page.Width} x {page.Height}");
// PdfiumViewer
var size = document.PageSizes[index];
Console.WriteLine($"{size.Width} x {size.Height}");

// IronPDF
var page = pdf.Pages[index];
Console.WriteLine($"{page.Width} x {page.Height}");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

機能比較の概要

フィーチャーPdfiumViewerIronPDF
PDFを読み込む
画像にレンダリング
内蔵ビューア
印刷用PDF
テキストの抽出
HTMLから作成
URLから作成
PDFのマージ
PDFの分割
透かしの追加
ヘッダー/フッター
フォーム入力
パスワード保護
WinFormsサポート
ASP.NETサポート
.NET Coreサポート制限的
アクティブメンテナンス不確実

移行チェックリスト

移行前

  • [コードベース内のすべてのPdfiumViewerの使用法を特定する。
  • [PdfViewer コントロールを使用した WinForms のリスト
  • [現在のレンダリングDPI設定の文書化
  • [ネイティブ・バイナリ参照のチェック
  • [印刷機能の用途を特定する
  • [ビューアコントロールのリプレース戦略の立案
  • [IronPDF ライセンスキーの取得

パッケージの変更

  • [ ] PdfiumViewer NuGetパッケージを削除する。
  • [ ] PdfiumViewer.Native.x86.v8-xfaパッケージを削除します。
  • [ ] PdfiumViewer.Native.x64.v8-xfaパッケージを削除します。
  • [ ] x86/とx64/フォルダからpdfium.dllのネイティブバイナリを削除する。
  • [ ] IronPdf NuGetパッケージをインストールします:dotnet add package IronPdf NuGetパッケージをインストールします。

コードの変更

  • [ ] 起動時にライセンスキー設定を追加する
  • [ ] PdfDocument.Load()PdfDocument.FromFile()に置き換えてください。
  • [ ] document.Save()pdf.SaveAs()に置き換えてください。
  • [ ] document.Render()pdf.ToBitmap()またはRasterizeToImageFiles()に置き換えてください。
  • [ ] document.PageSizes[i]pdf.Pages[i].Width/Heightに置き換えてください。
  • [ ] PdfViewerコントロールを外部ビューアまたはProcess.Start()で置き換える
  • [新しい機能の追加(テキスト抽出、HTMLからPDFへの変換など)

移行後

  • [レンダリング出力品質のテスト
  • [印刷機能のテスト
  • [ターゲットプラットフォームでのテスト
  • [新機能の追加(HTML to PDF、マージ、透かし、セキュリティ)
  • [ドキュメントの更新

結論

PdfiumViewerからIronPDFへの移行は、あなたのPDFワークフローをWindowsフォームの表示のみのライブラリから、すべての.NETアプリケーションタイプで作成、操作、テキスト抽出、レンダリング機能を持つ包括的なPDFソリューションに変えます。

この移行における主な変更点は以下のとおりです: 1.範囲:閲覧のみ → 完全なPDFソリューション 2.プラットフォーム:Windows Forms のみ → すべての .NET アプリケーションタイプ 3.ビューア: 組み込みのコントロール → バックエンド中心 (外部ビューアを使用) 4.読み込みPdfDocument.Load()PdfDocument.FromFile() 5.保存Save()SaveAs() です。 6.レンダリングRender(index, dpi, dpi, flag)ToBitmap(index)またはRasterizeToImageFiles()。 7.新機能:テキスト抽出、HTMLからPDFへの変換、マージ、透かし、セキュリティ、フォームなど。

IronPDFドキュメントチュートリアルAPIリファレンスを参照し、PdfiumViewerへの移行を促進してください。

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

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

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