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

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

GemBox PDFからIronPDFへの移行は、あなたの.NET PDFワークフローを座標ベースのプログラムによるドキュメント構築から最新のHTML/CSSベースのレンダリングへと変えます。 このガイドでは、段落の制限をなくし、.NET開発者のための文書作成を簡素化する、包括的でステップバイステップの移行パスを提供します。

なぜGemBox PDFからIronPDFへ移行するのか

GemBoxのPDFチャレンジ

GemBox PDF は有能な .NET PDF コンポーネントですが、実際の開発に影響する重大な制限があります:

1.無料版では段落数が 20 に制限されます:無料版では段落数が 20 に制限され、表のセルもこの制限にカウントされます。 単純な10行5列の表で50の"段落"を使用するため、無料版では基本的なビジネス文書でさえ使用できません。

  1. HTML から PDF への変換なし:GemBox PDFではプログラムによるドキュメント構築が必要です。 座標を計算し、すべての要素を手動で配置する必要があります-単純な"このHTMLをレンダリングする"機能はありません。

3.座標ベースのレイアウト:レイアウトが自然に流れる HTML/CSS とは異なり、GemBox PDF では、すべてのテキスト要素、画像、図形の正確な X/Y 位置を計算する必要があります。

4.機能セットが限られている:包括的な PDF ライブラリと比較すると、GemBox PDF は、HTML レンダリングや最新の CSS サポートなどの高度な機能がなく、読み取り、書き込み、結合、分割などの基本的な操作に重点を置いています。

5.プログラムのみ:設計を変更するたびにコードの変更が必要になります。 スペーシングを調整したいですか? 座標を再計算します。 異なるフォントサイズが必要ですか?その下のYの位置をすべて調整してください。

6.表のセルのカウント:段落制限は、表示されている段落だけでなく、表のセルもカウントします。そのため、表を含む文書では無料版は実質的に役に立ちません。

7.デザインの学習曲線:開発者はドキュメントのフローではなく座標で考える必要があるため、"段落を追加する"などの単純なタスクが驚くほど複雑になります。

GemBoxPDFとIronPDFの比較

アスペクト GemBox PDF IronPDF
無料版の制限 20段落(表セルを含む) 透かしのみ、内容制限なし
HTMLからPDFへ サポートされていません フルChromiumエンジン
レイアウトアプローチ 座標ベース、マニュアル HTML/CSSフローレイアウト
段落数にカウント 無制限、HTMLテーブル使用
モダンCSS 該当なし Flexbox、グリッド、CSS3アニメーション
JavaScriptサポート 該当なし 完全なJavaScriptの実行
デザインの変更 座標の再計算 HTML/CSSの編集
学習曲線 PDF座標系 HTML/CSS(ウェブに精通している)

2025年、2026年まで.NET 10とC# 14の採用を計画しているチームにとって、IronPDFはPDF生成のために使い慣れたウェブテクノロジーを活用する将来性のある基盤を提供します。


マイグレーションの複雑さの評価

機能別の見積もり作業

フィーチャー 移行の複雑さ ノート
PDFの読み込み/保存 低レベル ダイレクトメソッドマッピング
PDFのマージ 低レベル ダイレクトメソッドマッピング
PDFの分割 低レベル ページインデックスの処理
テキスト抽出 低レベル ダイレクトメソッドマッピング
テキストの追加 中規模 コーディネート → HTML
低レベル マニュアル → HTMLテーブル
画像 低レベル コーディネート → HTML
透かし 低レベル さまざまなAPI
パスワード保護 中規模 さまざまな構造
フォームフィールド 中規模 APIの違い

パラダイムシフト

このGemBox PDF移行における最大の変更点は、座標ベースのレイアウトからHTML/CSS レイアウトへの移行です。

GemBox PDF:  "位置 (100, 700) にテキストを描画"
IronPDF:     "CSSスタイリングでこのHTMLをレンダリングする"

このパラダイムシフトは、ウェブ技術に精通した開発者にとっては一般的に容易ですが、PDFについては別の考え方が必要です。


始める前に

前提条件

  1. .NETバージョン: IronPDFは.NET Framework 4.6.2以降および.NET Core 2.0以降 / .NET 5/6/7/8/9以降をサポートしています。 2.ライセンスキー: ironpdf.comからIronPDFライセンスキーを取得します。 3.バックアップ:移行作業用のブランチを作成する
  2. HTML/CSSの知識:基本的な知識があれば役立ちますが、必須ではありません

すべてのGemBox PDFの使用法を特定する

# Find allGemBox PDFreferences
grep -r "GemBox\.Pdf\|PdfDocument\|PdfPage\|PdfFormattedText\|ComponentInfo\.SetLicense" --include="*.cs" .

# Find package references
grep -r "GemBox\.Pdf" --include="*.csproj" .
# Find allGemBox PDFreferences
grep -r "GemBox\.Pdf\|PdfDocument\|PdfPage\|PdfFormattedText\|ComponentInfo\.SetLicense" --include="*.cs" .

# Find package references
grep -r "GemBox\.Pdf" --include="*.csproj" .
SHELL

NuGetパッケージの変更

# Remove GemBox PDF
dotnet remove package GemBox.Pdf

# Install IronPDF
dotnet add package IronPdf
# Remove GemBox PDF
dotnet remove package GemBox.Pdf

# Install IronPDF
dotnet add package IronPdf
SHELL

クイック スタート マイグレーション

ステップ 1: ライセンス構成の更新

翻訳前(GemBox PDF):

// Must call before anyGemBox PDFoperations
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
// Or for professional:
ComponentInfo.SetLicense("YOUR-PROFESSIONAL-LICENSE");
// Must call before anyGemBox PDFoperations
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
// Or for professional:
ComponentInfo.SetLicense("YOUR-PROFESSIONAL-LICENSE");
$vbLabelText   $csharpLabel

翻訳後(IronPDF):

// Set once at application startup
IronPdf.License.LicenseKey = "YOUR-IRONPDF-LICENSE-KEY";

// Or in appsettings.json:
// { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
// Set once at application startup
IronPdf.License.LicenseKey = "YOUR-IRONPDF-LICENSE-KEY";

// Or in appsettings.json:
// { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
$vbLabelText   $csharpLabel

ステップ 2: 名前空間インポートを更新する

// Before (GemBox PDF)
using GemBox.Pdf;
using GemBox.Pdf.Content;

// After (IronPDF)
using IronPdf;
using IronPdf.Editing;
// Before (GemBox PDF)
using GemBox.Pdf;
using GemBox.Pdf.Content;

// After (IronPDF)
using IronPdf;
using IronPdf.Editing;
$vbLabelText   $csharpLabel

ステップ 3: 基本的な変換パターン

翻訳前(GemBox PDF):

using GemBox.Pdf;
using GemBox.Pdf.Content;

ComponentInfo.SetLicense("FREE-LIMITED-KEY");

using (var document = new PdfDocument())
{
    var page = document.Pages.Add();
    var formattedText = new PdfFormattedText()
    {
        Text = "Hello World",
        FontSize = 24
    };

    page.Content.DrawText(formattedText, new PdfPoint(100, 700));
    document.Save("output.pdf");
}
using GemBox.Pdf;
using GemBox.Pdf.Content;

ComponentInfo.SetLicense("FREE-LIMITED-KEY");

using (var document = new PdfDocument())
{
    var page = document.Pages.Add();
    var formattedText = new PdfFormattedText()
    {
        Text = "Hello World",
        FontSize = 24
    };

    page.Content.DrawText(formattedText, new PdfPoint(100, 700));
    document.Save("output.pdf");
}
$vbLabelText   $csharpLabel

翻訳後(IronPDF):

using IronPdf;

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1 style='font-size:24px;'>Hello World</h1>");
pdf.SaveAs("output.pdf");
using IronPdf;

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1 style='font-size:24px;'>Hello World</h1>");
pdf.SaveAs("output.pdf");
$vbLabelText   $csharpLabel

主な違い:

  • 座標計算不要
  • プログラムレイアウトの代わりにHTML/CSS
  • 段落制限なし
  • よりシンプルで読みやすいコード

完全な API リファレンス

名前空間マッピング

GemBox PDF IronPDF
GemBox.Pdf IronPdf(IronPDF
GemBox.Pdf.Content IronPdf(コンテンツはHTMLです。)
GemBox.Pdf.Securityについて IronPdf(セキュリティ設定)
GemBox.Pdf.Formsについて IronPdf.Formsについて

コア クラス マッピング

GemBox PDF IronPDF 翻訳内容
PdfDocument PdfDocument 主なPDF文書クラス
PdfPage PdfDocument.Pages[i] ページ表現
Pdfコンテンツ 該当なし(HTMLを使用) ページ内容
PdfFormattedText 該当なし(HTMLを使用) 書式付きテキスト
PdfPoint 該当なし(CSSポジショニングを使用) ポジショニング
ComponentInfo.SetLicense()(コンポーネント情報.ライセンス設定)(コンポーネント情報.ライセンス設定 IronPdf.License.LicenseKey ライセンス管理

ドキュメント操作

GemBox PDF IronPDF ノート
new PdfDocument(). new PdfDocument(). 新規ドキュメントの作成
PdfDocument.Load(パス) PdfDocument.FromFile(パス) ファイルから読み込む
PdfDocument.Load(stream)を実行します。 PdfDocument.FromStream(stream)</code>PdfDocument.FromStream(stream) ストリームから読み込む
document.Save(パス)を実行します。 pdf.SaveAs(path)のようにします。 ファイルに保存
document.Save(stream)を実行します。 pdf.Streamまたは pdf.BinaryData ストリーム/バイトとして取得

ページ操作

GemBox PDF IronPDF ノート
document.Pages.Add() HTMLレンダリングによる作成 新しいページを追加
document.Pages.Count|pdf.PageCount` ページ数
ドキュメント.ページ[インデックス] pdf.Pages[index] アクセスページ(いずれもインデックス0)
document.Pages.AddClone(pages). PdfDocument.Merge()を使用してください。 クローン/マージページ

テキストとコンテンツの操作

GemBox PDF IronPDF ノート
new PdfFormattedText(). HTML文字列 テキスト内容
formattedText.FontSize = 12. CSS font-size: 12pt フォントサイズ
formattedText.Font = .... CSS `font-family: .... フォントファミリー
page.Content.DrawText(text, point). renderer.RenderHtmlAsPdf(html). テキストをレンダリングする.
page.Content.GetText()|pdf.ExtractTextFromPage(i)`のようにします。 テキスト抽出

コード移行の例

例1: HTMLからPDFへの変換

翻訳前(GemBox PDF):

// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using GemBox.Pdf.Content;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        var document = PdfDocument.Load("input.html");
        document.Save("output.pdf");
    }
}
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using GemBox.Pdf.Content;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        var document = PdfDocument.Load("input.html");
        document.Save("output.pdf");
    }
}
$vbLabelText   $csharpLabel

翻訳後(IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
        pdf.SaveAs("output.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
        pdf.SaveAs("output.pdf");
    }
}
$vbLabelText   $csharpLabel

IronPDFのChromePdfRendererは正確なHTML/CSS/JavaScriptレンダリングのために最新のChromiumエンジンを使用しています。 GemBox PDFの限られたHTMLサポートとは異なり、IronPdfはCSS3とJavaScriptを完全にサポートし、あらゆるHTMLコンテンツをレンダリングすることができます。 レンダリングオプションについては、HTML to PDF documentationを参照してください。

例2: PDFファイルをマージする

翻訳前(GemBox PDF):

// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using System.Linq;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var document = new PdfDocument())
        {
            var source1 = PdfDocument.Load("document1.pdf");
            var source2 = PdfDocument.Load("document2.pdf");

            document.Pages.AddClone(source1.Pages);
            document.Pages.AddClone(source2.Pages);

            document.Save("merged.pdf");
        }
    }
}
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using System.Linq;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var document = new PdfDocument())
        {
            var source1 = PdfDocument.Load("document1.pdf");
            var source2 = PdfDocument.Load("document2.pdf");

            document.Pages.AddClone(source1.Pages);
            document.Pages.AddClone(source2.Pages);

            document.Save("merged.pdf");
        }
    }
}
$vbLabelText   $csharpLabel

翻訳後(IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("document1.pdf");
        var pdf2 = PdfDocument.FromFile("document2.pdf");

        var merged = PdfDocument.Merge(pdf1, pdf2);
        merged.SaveAs("merged.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("document1.pdf");
        var pdf2 = PdfDocument.FromFile("document2.pdf");

        var merged = PdfDocument.Merge(pdf1, pdf2);
        merged.SaveAs("merged.pdf");
    }
}
$vbLabelText   $csharpLabel

IronPDFの静的なMergeメソッドは操作を単純化します。 PDFのマージと分割については、こちらをご覧ください。

例3: PDFにテキストを追加する

翻訳前(GemBox PDF):

// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using GemBox.Pdf.Content;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var document = new PdfDocument())
        {
            var page = document.Pages.Add();
            var formattedText = new PdfFormattedText()
            {
                Text = "Hello World",
                FontSize = 24
            };

            page.Content.DrawText(formattedText, new PdfPoint(100, 700));
            document.Save("output.pdf");
        }
    }
}
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using GemBox.Pdf.Content;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var document = new PdfDocument())
        {
            var page = document.Pages.Add();
            var formattedText = new PdfFormattedText()
            {
                Text = "Hello World",
                FontSize = 24
            };

            page.Content.DrawText(formattedText, new PdfPoint(100, 700));
            document.Save("output.pdf");
        }
    }
}
$vbLabelText   $csharpLabel

翻訳後(IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Editing;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<p>Original Content</p>");

        var stamper = new TextStamper()
        {
            Text = "Hello World",
            FontSize = 24,
            HorizontalOffset = 100,
            VerticalOffset = 700
        };

        pdf.ApplyStamp(stamper);
        pdf.SaveAs("output.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Editing;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<p>Original Content</p>");

        var stamper = new TextStamper()
        {
            Text = "Hello World",
            FontSize = 24,
            HorizontalOffset = 100,
            VerticalOffset = 700
        };

        pdf.ApplyStamp(stamper);
        pdf.SaveAs("output.pdf");
    }
}
$vbLabelText   $csharpLabel

既存のPDFにテキストを追加するために、IronPDFは正確な位置制御を提供するTextStamperクラスを提供します。 新しいドキュメントの場合は、HTMLテンプレートにテキストを含めるだけです。 追加オプションについては、スタンプのドキュメントを参照してください。

例4: テーブルの作成 (最大の改善点!)

Before (GemBox PDF) - 各セルは20段落の制限にカウントされます:

using GemBox.Pdf;
using GemBox.Pdf.Content;

ComponentInfo.SetLicense("FREE-LIMITED-KEY");

using (var document = new PdfDocument())
{
    var page = document.Pages.Add();
    double y = 700;
    double[] xPositions = { 50, 200, 300, 400 };

    // Headers (4 paragraphs)
    var headers = new[] { "Product", "Price", "Qty", "Total" };
    for (int i = 0; i < headers.Length; i++)
    {
        var text = new PdfFormattedText { Text = headers[i], FontSize = 12 };
        page.Content.DrawText(text, new PdfPoint(xPositions[i], y));
    }
    y -= 20;

    // Data rows (4 paragraphs per row!)
    // Can only add a few rows before hitting 20-paragraph limit!

    document.Save("products.pdf");
}
using GemBox.Pdf;
using GemBox.Pdf.Content;

ComponentInfo.SetLicense("FREE-LIMITED-KEY");

using (var document = new PdfDocument())
{
    var page = document.Pages.Add();
    double y = 700;
    double[] xPositions = { 50, 200, 300, 400 };

    // Headers (4 paragraphs)
    var headers = new[] { "Product", "Price", "Qty", "Total" };
    for (int i = 0; i < headers.Length; i++)
    {
        var text = new PdfFormattedText { Text = headers[i], FontSize = 12 };
        page.Content.DrawText(text, new PdfPoint(xPositions[i], y));
    }
    y -= 20;

    // Data rows (4 paragraphs per row!)
    // Can only add a few rows before hitting 20-paragraph limit!

    document.Save("products.pdf");
}
$vbLabelText   $csharpLabel

翻訳後 (IronPDF) - 制限なし、適切なHTMLテーブル:

using IronPdf;

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

var html = @"
    <html>
    <head>
        <style>
            table { border-collapse: collapse; width: 100%; }
            th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
            th { background-color: #4CAF50; color: white; }
            tr:nth-child(even) { background-color: #f2f2f2; }
        </style>
    </head>
    <body>
        <table>
            <thead>
                <tr>
                    <th>Product</th>
                    <th>Price</th>
                    <th>Qty</th>
                    <th>Total</th>
                </tr>
            </thead>
            <tbody>
                <tr><td>Widget A</td><td>$19.99</td><td>5</td><td>$99.95</td></tr>
                <tr><td>Widget B</td><td>$29.99</td><td>3</td><td>$89.97</td></tr>

            </tbody>
        </table>
    </body>
    </html>";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("products.pdf");
using IronPdf;

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

var html = @"
    <html>
    <head>
        <style>
            table { border-collapse: collapse; width: 100%; }
            th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
            th { background-color: #4CAF50; color: white; }
            tr:nth-child(even) { background-color: #f2f2f2; }
        </style>
    </head>
    <body>
        <table>
            <thead>
                <tr>
                    <th>Product</th>
                    <th>Price</th>
                    <th>Qty</th>
                    <th>Total</th>
                </tr>
            </thead>
            <tbody>
                <tr><td>Widget A</td><td>$19.99</td><td>5</td><td>$99.95</td></tr>
                <tr><td>Widget B</td><td>$29.99</td><td>3</td><td>$89.97</td></tr>

            </tbody>
        </table>
    </body>
    </html>";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("products.pdf");
$vbLabelText   $csharpLabel

これは、GemBox PDF マイグレーションにおける最も重要な改善点です。 GemBox PDFの無料版では不可能であったテーブルも、IronPdfではCSSスタイリングが完全にサポートされ、完璧に機能します。


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

CSSポジショニングへの調整

ピクセルパーフェクトな位置決め(GemBox PDFの座標系と同様)が必要な場合は、CSS絶対位置決めを使用してください:

<div style="position:absolute; left:50px; top:750px; font-size:24px;">
    Text positioned at specific coordinates
</div>
<div style="position:absolute; left:50px; top:750px; font-size:24px;">
    Text positioned at specific coordinates
</div>
HTML

ページ索引

GemBox PDFとIronPDFはどちらも0-indexed pagesを使用しているため、移行は簡単です:

// GemBox PDF
var page = document.Pages[0];

// IronPDF
var page = pdf.Pages[0];
// GemBox PDF
var page = document.Pages[0];

// IronPDF
var page = pdf.Pages[0];
$vbLabelText   $csharpLabel

セキュリティ設定

// GemBox PDF
document.SaveOptions.SetPasswordEncryption(userPassword, ownerPassword);

// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
// GemBox PDF
document.SaveOptions.SetPasswordEncryption(userPassword, ownerPassword);

// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
$vbLabelText   $csharpLabel

トラブルシューティング

問題 1: PdfFormattedText が見つかりません

問題:IronPDFにPdfFormattedText存在しません。

解決策: CSS スタイルを使用した HTML を使用する:

// GemBox PDF
var text = new PdfFormattedText { Text = "Hello", FontSize = 24 };

// IronPDF
var html = "<p style='font-size:24px;'>Hello</p>";
var pdf = renderer.RenderHtmlAsPdf(html);
// GemBox PDF
var text = new PdfFormattedText { Text = "Hello", FontSize = 24 };

// IronPDF
var html = "<p style='font-size:24px;'>Hello</p>";
var pdf = renderer.RenderHtmlAsPdf(html);
$vbLabelText   $csharpLabel

問題 2: DrawText メソッドが見つかりません

問題: page.Content.DrawText()は使用できません。

解決策: HTML レンダリングでコンテンツを作成するか、スタンパーを使用します。

// For new documents - render HTML
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>");

// For existing documents - use stampers
var stamper = new TextStamper() { Text = "Added Text" };
pdf.ApplyStamp(stamper);
// For new documents - render HTML
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>");

// For existing documents - use stampers
var stamper = new TextStamper() { Text = "Added Text" };
pdf.ApplyStamp(stamper);
$vbLabelText   $csharpLabel

課題3:ドキュメントの読み込みの違い

問題: PdfDocument.Load()が見つかりません。

解決策: PdfDocument.FromFile()またはFromStream()を使用します。

// GemBox PDF
var doc = PdfDocument.Load("input.pdf");

// IronPDF
var pdf = PdfDocument.FromFile("input.pdf");
// GemBox PDF
var doc = PdfDocument.Load("input.pdf");

// IronPDF
var pdf = PdfDocument.FromFile("input.pdf");
$vbLabelText   $csharpLabel

課題4:保存メソッドの違い

問題: document.Save()メソッドのシグネチャが異なります。

解決策: SaveAs()を使用します。

// GemBox PDF
document.Save("output.pdf");

// IronPDF
pdf.SaveAs("output.pdf");
// GemBox PDF
document.Save("output.pdf");

// IronPDF
pdf.SaveAs("output.pdf");
$vbLabelText   $csharpLabel

移行チェックリスト

移行前

  • コードベース内のすべてのGemBox PDFの使用状況をインベントリします
  • HTML 変換が必要な座標ベースのレイアウトを識別する
  • コードに影響する現在の段落制限を評価する
  • IronPDFライセンスキーを取得する
  • バージョン管理に移行ブランチを作成する

コードの移行

-GemBox PDFNuGet パッケージを削除します: dotnet remove package GemBox.Pdf

  • IronPdf NuGet パッケージをインストールします: dotnet add package IronPdf
  • 名前空間のインポートを更新する
  • ComponentInfo.SetLicense()IronPdf.License.LicenseKeyに置き換えます
  • PdfDocument.Load()PdfDocument.FromFile()に変換する
  • document.Save()pdf.SaveAs()に変換する
  • 座標ベースのテキストをHTMLコンテンツに置き換える -PdfFormattedText`CSSスタイルでHTMLに変換する
  • マージ操作を更新してPdfDocument.Merge()を使用するようにしました

テスティング

  • すべてのドキュメントが正しく生成されたことを確認する
  • ドキュメントの外観が期待どおりであることを検証する
  • テストテーブルの生成(以前は20段落ルールによって制限されていました)
  • テキスト抽出が正しく機能していることを確認する
  • マージと分割操作をテストする
  • セキュリティ/暗号化機能の検証

移行後

  • GemBox PDFライセンスキーを削除する
  • ドキュメントの更新
  • PDF の HTML/CSS アプローチについてチームをトレーニングする
  • 段落制限なしで無制限のコンテンツをお楽しみください!

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

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

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