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

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

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

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

PdfiumViewerを理解する

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

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

PdfiumViewerの重要な制限事項

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

  1. Windows フォーム固有:このライブラリは Windows フォーム アプリケーションに重点を置いており、他のユーザー インターフェイス フレームワークはサポートしていません。

  2. PDF 操作不可: PDF コンテンツを結合、分割、または変更することはできません。

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

5.不確実なメンテナンス:アップデートが制限されており、長期的なサポートが不明確です。

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

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

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

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

10.セキュリティ機能なし: PDF を暗号化したりパスワードで保護したりできません。

PdfiumViewerとIronPdfの比較

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

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


始める前に

前提条件

  1. .NET環境:.NET Framework4.6.2+ または.NET Core 3.1+ / .NET 5/6/7/8/9+
  2. NuGetアクセス: NuGetパッケージをインストールする機能
  3. IronPDFライセンス: IronPDFからライセンスキーを取得します。

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";
' Add at application startup (Program.vb or Startup.vb)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
$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;
Imports PdfiumViewer

Imports IronPdf
Imports IronPdf.Rendering
Imports IronPdf.Editing
$vbLabelText   $csharpLabel

コア クラス マッピング

PdfiumViewer IronPDF
PdfDocument PdfDocument
PdfViewer (同等のものはありません)_
PdfRenderer ChromePdfRenderer
(利用できません) HtmlHeaderFooter

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

PdfiumViewer IronPDF
PdfDocument.Load(path) PdfDocument.FromFile(path)
PdfDocument.Load(stream) PdfDocument.FromStream(stream)
PdfDocument.Load(bytes) PdfDocument.FromBinaryData(bytes)

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

PdfiumViewer IronPDF
document.PageCount document.PageCount
document.PageSizes document.Pages[i].Width/Height
document.GetPageSize(index) document.Pages[index].Width/Height

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

PdfiumViewer IronPDF
document.Render(pageIndex, dpiX, dpiY, forPrinting) pdf.ToBitmap(pageIndex)
document.Render(pageIndex, width, height, dpiX, dpiY, flags) pdf.RasterizeToImageFiles(path, dpi)

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

PdfiumViewer IronPDF
document.Save(path) 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}");
    }
}
Imports PdfiumViewer
Imports System
Imports System.Text

Dim pdfPath As String = "document.pdf"

' PDFiumViewer has limited text extraction capabilities
' It's primarily designed for rendering, not text extraction
Using document = PdfDocument.Load(pdfPath)
    Dim pageCount As Integer = 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 i As Integer = 0 To pageCount - 1
        Dim pageImage = document.Render(i, 96, 96, False)
        Console.WriteLine($"Rendered page {i + 1}")
    Next
End Using
$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}");
Imports IronPdf
Imports System

Module Program
    Sub Main()
        Dim pdfPath As String = "document.pdf"

        ' Open and extract text from PDF
        Dim pdf As PdfDocument = PdfDocument.FromFile(pdfPath)

        ' Extract text from all pages
        Dim allText As String = pdf.ExtractAllText()
        Console.WriteLine("Extracted Text:")
        Console.WriteLine(allText)

        ' Extract text from specific page
        Dim pageText As String = pdf.ExtractTextFromPage(0)
        Console.WriteLine(vbCrLf & "First page text: " & pageText)

        Console.WriteLine(vbCrLf & "Total pages: " & pdf.PageCount)
    End Sub
End Module
$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);
}
Imports PdfiumViewer
Imports System.IO
Imports 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:

Dim htmlContent As String = "<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:

Dim existingPdfPath As String = "output.pdf"
Using document = PdfDocument.Load(existingPdfPath)
    ' Can only render/display existing PDF
    Dim image = document.Render(0, 300, 300, True)
End Using
$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!");
Imports IronPdf
Imports System

Module Program
    Sub Main()
        Dim htmlContent As String = "<h1>Hello World</h1><p>This is a test document.</p>"

        ' Create a PDF from HTML string
        Dim renderer As New ChromePdfRenderer()
        Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf(htmlContent)

        ' Save the PDF
        pdf.SaveAs("output.pdf")

        Console.WriteLine("PDF created successfully!")
    End Sub
End Module
$vbLabelText   $csharpLabel

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

IronPDF は、HTML、CSS、 JavaScriptを正確にレンダリングするために内部で Chromium エンジンを使用する ChromePdfRenderer を通じてネイティブの HTML から PDF への変換を提供します。 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);
        }
    }
}
Imports PdfiumViewer
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging

Module Module1
    Sub Main()
        Dim pdfPath As String = "document.pdf"
        Dim outputImage As String = "page1.png"

        ' PDFiumViewer excels at rendering PDFs to images
        Using document = PdfDocument.Load(pdfPath)
            ' Render first page at 300 DPI
            Dim dpi As Integer = 300
            Using image = document.Render(0, dpi, dpi, True)
                ' Save as PNG
                image.Save(outputImage, ImageFormat.Png)
                Console.WriteLine($"Page rendered to {outputImage}")
            End Using

            ' Render all pages
            For i As Integer = 0 To document.PageCount - 1
                Using pageImage = document.Render(i, 150, 150, True)
                    pageImage.Save($"page_{i + 1}.png", ImageFormat.Png)
                End Using
            Next
        End Using
    End Sub
End Module
$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}");
Imports IronPdf
Imports System
Imports System.Linq

Module Module1
    Sub Main()
        Dim pdfPath As String = "document.pdf"
        Dim outputImage As String = "page1.png"

        ' Open PDF and convert to images
        Dim pdf As PdfDocument = PdfDocument.FromFile(pdfPath)

        ' Convert first page to image
        Dim firstPageImage = pdf.ToBitmap(0)
        firstPageImage(0).Save(outputImage)
        Console.WriteLine($"Page rendered to {outputImage}")

        ' Convert all pages to images
        Dim allPageImages = pdf.ToBitmap()
        For i As Integer = 0 To allPageImages.Length - 1
            allPageImages(i).Save($"page_{i + 1}.png")
            Console.WriteLine($"Saved page {i + 1}")
        Next

        Console.WriteLine($"Total pages converted: {pdf.PageCount}")
    End Sub
End Module
$vbLabelText   $csharpLabel

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

PdfiumViewer は、適切な廃棄のために、ネストされた using ステートメントを含む document.Render(pageIndex, dpiX, dpiY, forPrinting) を使用します。 ImageFormat 列挙型には、System.DrawingSystem.Drawing.Imaging をインポートする必要があります。

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


ネイティブ依存性の除去

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

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

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

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

MyApp/
├── ビン/
│ ├──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 });
' PdfiumViewer: Built-in viewer control
pdfViewer.Document = document

' IronPDF: Use external viewer or web-based approach
pdf.SaveAs(tempPath)
Process.Start(New ProcessStartInfo(tempPath) With {.UseShellExecute = True})
$vbLabelText   $csharpLabel

表示が必要な場合は、Process.Start() を使用して、デフォルトの PDF ビューアー、PDF パスを含む WebBrowser コントロール、または Syncfusion、DevExpress、Telerik などのサードパーティのビューアー コントロールで開くことを検討してください。

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

// PdfiumViewer
PdfDocument.Load(path)

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

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

' IronPDF
PdfDocument.FromFile(path)
$vbLabelText   $csharpLabel

保存メソッドの変更

// PdfiumViewer
document.Save(path)

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

// IronPDF
pdf.SaveAs(path)
$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");
Imports System.Drawing.Imaging

' PdfiumViewer: Returns image with nested using
Using image = document.Render(0, 150, 150, True)
    image.Save("page.png", ImageFormat.Png)
End Using

' IronPDF: Returns bitmap array
Dim images = pdf.ToBitmap(0)
images(0).Save("page.png")
$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}");
' PdfiumViewer
Dim size = document.PageSizes(index)
Console.WriteLine($"{size.Width} x {size.Height}")

' IronPDF
Dim page = pdf.Pages(index)
Console.WriteLine($"{page.Width} x {page.Height}")
$vbLabelText   $csharpLabel

機能比較の概要

フィーチャー PdfiumViewer IronPDF
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

コードの変更

  • 起動時にライセンスキー設定を追加する
  • 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からPDFへの変換、結合、透かし、セキュリティ)
  • ドキュメントの更新

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

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

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

アイアンサポートチーム

私たちは週5日、24時間オンラインで対応しています。
チャット
メール
電話してね