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

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

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

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

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

GemBoxのPDFチャレンジ

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

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

2.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 PDFIronPDF
無料版の制限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.バックアップ:移行作業用のブランチを作成する 4.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");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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" }
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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;
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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");
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

主な違い:

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

完全な API リファレンス

名前空間マッピング

GemBox PDFIronPDF
<コード>GemBox.Pdf</コードIronPdf(アイアンPDF
<コード>GemBox.Pdf.Content</コードIronPdf(コンテンツはHTMLです。)
GemBox.Pdf.SecurityについてIronPdf(セキュリティ設定)
GemBox.Pdf.FormsについてIronPdf.Formsについて

コア クラス マッピング

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

ドキュメント操作

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

ページ操作

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

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

GemBox PDFIronPDFノート
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");
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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");
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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");
        }
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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");
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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");
        }
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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");
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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");
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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>
                <!-- Add hundreds or thousands of rows - no limit! -->
            </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>
                <!-- Add hundreds or thousands of rows - no limit! -->
            </tbody>
        </table>
    </body>
    </html>";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("products.pdf");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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];
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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";
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

トラブルシューティング

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

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

ソリューション: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);
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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);
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

移行チェックリスト

移行前

  • [ ] コードベース内のすべてのGemBox PDFの使用状況のインベントリ作成
  • [HTML 変換が必要な座標ベースのレイアウトを特定する。
  • [コードに影響を与える現在の段落制限の評価
  • [IronPDF ライセンスキーの取得
  • [バージョン管理でマイグレーションブランチを作成する

コードの移行

  • [ ]GemBox PDFNuGet パッケージを削除します:dotnet remove package GemBox.Pdf を削除します。
  • [ ] IronPdf NuGetパッケージをインストールします:dotnet add package IronPdf<//code>.
  • [名前空間インポートの更新
  • [ ] 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 アプローチについてチームをトレーニングする。
  • [段落制限のない無制限のコンテンツをお楽しみください!

結論

GemBox PDFからIronPdfに移行することで、テーブルのセルをカウントする20段落の制限がなくなり、座標ベースのポジショニングが直感的なHTML/CSSレイアウトに置き換えられ、正確なドキュメント生成のための最新のChromiumベースのレンダリングエンジンが提供されます。

プログラムによるドキュメント構築からHTMLベースのレンダリングへのパラダイムシフトは、ほとんどの開発者がすでに持っているスキルを活用し、開発時間を短縮し、HTMLとCSSを編集するのと同じくらい簡単にデザインを変更することができます。 ドキュメントを多用するアプリケーションを構築するチームにとって、このGemBox PDF移行は人工的なコンテンツ制限を取り除き、複雑でプロフェッショナルな PDF 生成の可能性を開きます。

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

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

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

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