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

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

iText からIronPDFに移行すると、 .NET PDF ワークフローが、Table、および Cell オブジェクトの手動構築を必要とするプログラム API から、完全な CSS3 およびJavaScriptサポートを備えた最新の HTML ファースト アプローチに変換されます。 このガイドでは、プロ for .NET開発者向けに、AGPLライセンスに関する懸念や、pdfHTMLアドオンを別途用意する必要性を排除した、包括的でステップバイステップの移行パスを提供します。

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

AGPLライセンスの罠

iTextは、商用アプリケーションに深刻な法的リスクとビジネスリスクをもたらします:

  1. AGPL ウイルス ライセンス: Web アプリケーションで iText を使用する場合、AGPL では、PDF コードだけでなく、コードベース全体を含むアプリケーション全体をオープンソース化する必要があります。 これは、ほとんどの商用ソフトウェアでは不可能です。

2.永久ライセンスなし: iText では永久ライセンスが廃止され、年間サブスクリプションの更新が強制され、総所有コストが増加します。

  1. pdfHTML アドオンのコスト: HTML から PDF への機能には、基本ライセンスに加えて追加料金で別売りされている pdfHTML アドオンが必要です。

4.複雑なライセンス監査:企業での導入では、ライセンスの複雑さと監査リスクが伴い、プロジェクトの遅延や法的リスクが生じる可能性があります。

5.プログラム専用 API: iText では、Cell オブジェクトを使用した低レベルの PDF 構築を手動で行う必要があります。複雑なレイアウトの場合、作業が面倒でエラーが発生しやすくなります。

6.最新の Web レンダリングの制限: pdfHTML を使用した場合でも、複雑な CSS およびJavaScriptコンテンツには、かなりの追加作業が必要です。

iTextとIronPDFの比較

フィーチャー iText 7 / iTextSharp IronPDF
ライセンス AGPL(バイラル)または高価なサブスクリプション 商用、永久オプション
HTMLからPDFへ pdfHTMLアドオン 内蔵Chromiumレンダラー
CSSサポート 基本的なCSS フルCSS3、フレックスボックス、グリッド
JavaScript なし 完全な実行
APIパラダイム プログラム(段落、表、セル) CSSによるHTMLファースト
学習曲線 スティープ(PDF座標系) ウェブ開発者フレンドリー
オープンソースリスク オープンソースのウェブアプリケーションが必要 ウイルス要件なし
価格モデル サブスクリプションのみ 永久またはサブスクリプション

2025年、2026年まで.NET 10とC# 14の導入を計画しているチームにとって、IronPDFはすでにチームが持っているウェブ開発スキルを活用するHTMLファーストのアプローチで、将来を見据えた基盤を提供します。


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

機能別の見積もり作業

フィーチャー 移行の複雑さ
HTMLからPDFへ 低レベル
PDFのマージ 低レベル
テキストと画像 低レベル
中規模
ヘッダー/フッター 中規模
セキュリティ/暗号化 低レベル

パラダイムシフト

この iText 移行における基本的な変化は、プログラムによる PDF 構築からHTML ファーストのレンダリングへの変化です。

iText:    PdfWriter → PdfDocument → Document → Add(Paragraph) → Add(Table)
IronPDF:  ChromePdfRenderer → RenderHtmlAsPdf(htmlString) → SaveAs()

iTextのオブジェクトモデルを学ぶ代わりに、ウェブ開発者がすでに持っているHTMLとCSSのスキルを使うのです。


始める前に

前提条件

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

NuGetパッケージの変更

# Remove iText packages
dotnet remove package itext7
dotnet remove package itext7.pdfhtml
dotnet remove package itextsharp

# Install IronPDF
dotnet add package IronPdf
# Remove iText packages
dotnet remove package itext7
dotnet remove package itext7.pdfhtml
dotnet remove package itextsharp

# 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

iTextの使用方法を確認する

# Find all iText references
grep -r "using iText\|using iTextSharp" --include="*.cs" .
grep -r "PdfWriter\|PdfDocument\|Document\|Paragraph\|Table\|Cell" --include="*.cs" .
grep -r "HtmlConverter\|ConverterProperties" --include="*.cs" .
# Find all iText references
grep -r "using iText\|using iTextSharp" --include="*.cs" .
grep -r "PdfWriter\|PdfDocument\|Document\|Paragraph\|Table\|Cell" --include="*.cs" .
grep -r "HtmlConverter\|ConverterProperties" --include="*.cs" .
SHELL

完全な API リファレンス

クラスマッピング

iText 7 クラス iTextSharpクラス IronPDF 同等物
PdfWriter PdfWriter ChromePdfRenderer
PdfDocument Document PdfDocument
Document Document ChromePdfRenderer.RenderHtmlAsPdf()
Paragraph Paragraph HTML <h1> など
Table PdfPTable HTML <table>
Cell PdfPCell HTML <th>
Image Image HTML <img>
PdfReader PdfReader PdfDocument.FromFile()
PdfMerger 該当なし PdfDocument.Merge()

名前空間マッピング

iText 7 名前空間 IronPDF 同等物
iText.Kernel.Pdf IronPdf
iText.Layout IronPdf
iText.Layout.Element HTML要素の使用
iText.Html2Pdf IronPdf (組み込み)
iText.IO.Image HTML を使用してください <img>
iText.Kernel.Utils IronPdf

コード移行の例

例1: HTMLからPDFへの変換

導入前(iText 7):

// NuGet: Install-Package itext7
using iText.Html2pdf;
using System.IO;

class Program
{
    static void Main()
    {
        string html = "<h1>Hello World</h1><p>This is a PDF from HTML.</p>";
        string outputPath = "output.pdf";

        using (FileStream fs = new FileStream(outputPath, FileMode.Create))
        {
            HtmlConverter.ConvertToPdf(html, fs);
        }
    }
}
// NuGet: Install-Package itext7
using iText.Html2pdf;
using System.IO;

class Program
{
    static void Main()
    {
        string html = "<h1>Hello World</h1><p>This is a PDF from HTML.</p>";
        string outputPath = "output.pdf";

        using (FileStream fs = new FileStream(outputPath, FileMode.Create))
        {
            HtmlConverter.ConvertToPdf(html, fs);
        }
    }
}
Imports iText.Html2pdf
Imports System.IO

Class Program
    Shared Sub Main()
        Dim html As String = "<h1>Hello World</h1><p>This is a PDF from HTML.</p>"
        Dim outputPath As String = "output.pdf"

        Using fs As FileStream = New FileStream(outputPath, FileMode.Create)
            HtmlConverter.ConvertToPdf(html, fs)
        End Using
    End Sub
End Class
$vbLabelText   $csharpLabel

翻訳後(IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        string html = "<h1>Hello World</h1><p>This is a PDF from HTML.</p>";

        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("output.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        string html = "<h1>Hello World</h1><p>This is a PDF from HTML.</p>";

        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("output.pdf");
    }
}
Imports IronPdf

Class Program
    Shared Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim html As String = "<h1>Hello World</h1><p>This is a PDF from HTML.</p>"

        Dim pdf = renderer.RenderHtmlAsPdf(html)
        pdf.SaveAs("output.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

iText アプローチでは、別の iText.Html2pdf パッケージ (pdfHTML アドオン、別売) が必要であり、FileStream を作成し、すべてを using ステートメントでラップして適切に破棄する必要があります。 HtmlConverter.ConvertToPdf() メソッドはストリームに直接書き込みます。

IronPDF のアプローチはより簡潔です: ChromePdfRenderer を作成し、HTML 文字列で RenderHtmlAsPdf() を呼び出し、結果の PdfDocumentSaveAs() を呼び出します。 別パッケージ、ストリーム管理は不要で、Chromiumレンダリングエンジンは優れたCSS3とJavaScriptをサポートします。 その他のレンダリングオプションについては、HTML to PDF documentationを参照してください。

例2: 複数のPDFをマージする

導入前(iText 7):

// NuGet: Install-Package itext7
using iText.Kernel.Pdf;
using iText.Kernel.Utils;
using System.IO;

class Program
{
    static void Main()
    {
        string outputPath = "merged.pdf";
        string[] inputFiles = { "document1.pdf", "document2.pdf", "document3.pdf" };

        using (PdfWriter writer = new PdfWriter(outputPath))
        using (PdfDocument pdfDoc = new PdfDocument(writer))
        {
            PdfMerger merger = new PdfMerger(pdfDoc);

            foreach (string file in inputFiles)
            {
                using (PdfDocument sourcePdf = new PdfDocument(new PdfReader(file)))
                {
                    merger.Merge(sourcePdf, 1, sourcePdf.GetNumberOfPages());
                }
            }
        }
    }
}
// NuGet: Install-Package itext7
using iText.Kernel.Pdf;
using iText.Kernel.Utils;
using System.IO;

class Program
{
    static void Main()
    {
        string outputPath = "merged.pdf";
        string[] inputFiles = { "document1.pdf", "document2.pdf", "document3.pdf" };

        using (PdfWriter writer = new PdfWriter(outputPath))
        using (PdfDocument pdfDoc = new PdfDocument(writer))
        {
            PdfMerger merger = new PdfMerger(pdfDoc);

            foreach (string file in inputFiles)
            {
                using (PdfDocument sourcePdf = new PdfDocument(new PdfReader(file)))
                {
                    merger.Merge(sourcePdf, 1, sourcePdf.GetNumberOfPages());
                }
            }
        }
    }
}
Imports iText.Kernel.Pdf
Imports iText.Kernel.Utils
Imports System.IO

Class Program
    Shared Sub Main()
        Dim outputPath As String = "merged.pdf"
        Dim inputFiles As String() = {"document1.pdf", "document2.pdf", "document3.pdf"}

        Using writer As New PdfWriter(outputPath)
            Using pdfDoc As New PdfDocument(writer)
                Dim merger As New PdfMerger(pdfDoc)

                For Each file As String In inputFiles
                    Using sourcePdf As New PdfDocument(New PdfReader(file))
                        merger.Merge(sourcePdf, 1, sourcePdf.GetNumberOfPages())
                    End Using
                Next
            End Using
        End Using
    End Sub
End Class
$vbLabelText   $csharpLabel

翻訳後(IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var pdfDocuments = new List<PdfDocument>
        {
            PdfDocument.FromFile("document1.pdf"),
            PdfDocument.FromFile("document2.pdf"),
            PdfDocument.FromFile("document3.pdf")
        };

        var merged = PdfDocument.Merge(pdfDocuments);
        merged.SaveAs("merged.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var pdfDocuments = new List<PdfDocument>
        {
            PdfDocument.FromFile("document1.pdf"),
            PdfDocument.FromFile("document2.pdf"),
            PdfDocument.FromFile("document3.pdf")
        };

        var merged = PdfDocument.Merge(pdfDocuments);
        merged.SaveAs("merged.pdf");
    }
}
Imports IronPdf
Imports System.Collections.Generic

Class Program
    Shared Sub Main()
        Dim pdfDocuments As New List(Of PdfDocument) From {
            PdfDocument.FromFile("document1.pdf"),
            PdfDocument.FromFile("document2.pdf"),
            PdfDocument.FromFile("document3.pdf")
        }

        Dim merged = PdfDocument.Merge(pdfDocuments)
        merged.SaveAs("merged.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

iText のマージ操作には、大量の定型句が必要です。出力用に PdfWriter を作成し、それを PdfDocument でラップし、PdfMerger を作成してから、PdfDocumentPdfReader ごとにネストされた using ステートメントを使用してソース ファイルを反復処理します。 また、merger.Merge(sourcePdf, 1, sourcePdf.GetNumberOfPages()) を使用してページ範囲を指定する必要があります。

IronPDF はこれを 3 つのステップに短縮します。つまり、PdfDocument.FromFile() を使用してドキュメントを読み込み、リストを使用して静的な PdfDocument.Merge() メソッドを呼び出して、保存します。 マージ作業全体が読みやすく、保守しやすくなります。 PDFのマージと分割については、こちらをご覧ください。

例3: テキストと画像でPDFを作成する

導入前(iText 7):

// NuGet: Install-Package itext7
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
using iText.IO.Image;

class Program
{
    static void Main()
    {
        string outputPath = "document.pdf";

        using (PdfWriter writer = new PdfWriter(outputPath))
        using (PdfDocument pdf = new PdfDocument(writer))
        using (Document document = new Document(pdf))
        {
            document.Add(new Paragraph("Sample PDF Document"));
            document.Add(new Paragraph("This document contains text and an image."));

            Image img = new Image(ImageDataFactory.Create("image.jpg"));
            img.SetWidth(200);
            document.Add(img);
        }
    }
}
// NuGet: Install-Package itext7
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
using iText.IO.Image;

class Program
{
    static void Main()
    {
        string outputPath = "document.pdf";

        using (PdfWriter writer = new PdfWriter(outputPath))
        using (PdfDocument pdf = new PdfDocument(writer))
        using (Document document = new Document(pdf))
        {
            document.Add(new Paragraph("Sample PDF Document"));
            document.Add(new Paragraph("This document contains text and an image."));

            Image img = new Image(ImageDataFactory.Create("image.jpg"));
            img.SetWidth(200);
            document.Add(img);
        }
    }
}
Imports iText.Kernel.Pdf
Imports iText.Layout
Imports iText.Layout.Element
Imports iText.IO.Image

Class Program
    Shared Sub Main()
        Dim outputPath As String = "document.pdf"

        Using writer As New PdfWriter(outputPath),
              pdf As New PdfDocument(writer),
              document As New Document(pdf)

            document.Add(New Paragraph("Sample PDF Document"))
            document.Add(New Paragraph("This document contains text and an image."))

            Dim img As New Image(ImageDataFactory.Create("image.jpg"))
            img.SetWidth(200)
            document.Add(img)
        End Using
    End Sub
End Class
$vbLabelText   $csharpLabel

翻訳後(IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();

        string html = @"
            <h1>Sample PDF Document</h1>
            <p>This document contains text and an image.</p>
            <img src='image.jpg' width='200' />";

        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("document.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();

        string html = @"
            <h1>Sample PDF Document</h1>
            <p>This document contains text and an image.</p>
            <img src='image.jpg' width='200' />";

        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("document.pdf");
    }
}
Imports IronPdf

Class Program
    Shared Sub Main()
        Dim renderer = New ChromePdfRenderer()

        Dim html As String = "
            <h1>Sample PDF Document</h1>
            <p>This document contains text and an image.</p>
            <img src='image.jpg' width='200' />"

        Dim pdf = renderer.RenderHtmlAsPdf(html)
        pdf.SaveAs("document.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

この例は、パラダイムシフトを最も明確に示しています。 iTextが必要です:

  • 3 重ネストされた using ステートメント (Document)
  • new Paragraph() を使用して各テキスト要素に Paragraph オブジェクトを作成します。
  • ImageDataFactory.Create() を使用して画像を読み込みます
  • Image オブジェクトを作成し、SetWidth() を個別に呼び出す
  • 各要素に対してdocument.Add()を呼び出す

IronPDF は標準 HTML を使用します: 見出しには <h1>、段落には <p>、属性を持つ画像には width です。 ウェブ開発者は既存のスキルをすぐに活用でき、デザイナーはすでに知っているCSSを使ってドキュメントをスタイリングできます。


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

パラダイムシフト:プログラムからHTMLファーストへ

このiTextの移行で最も大きな変更は、概念的なものです。 iTextはプログラムでPDFを作成します:

// iText approach
document.Add(new Paragraph("Title")
    .SetTextAlignment(TextAlignment.CENTER)
    .SetFontSize(24)
    .SetBold());

var table = new Table(UnitValue.CreatePercentArray(3)).UseAllAvailableWidth();
table.AddHeaderCell(new Cell().Add(new Paragraph("ID")));
table.AddHeaderCell(new Cell().Add(new Paragraph("Name")));
// ... many more lines
// iText approach
document.Add(new Paragraph("Title")
    .SetTextAlignment(TextAlignment.CENTER)
    .SetFontSize(24)
    .SetBold());

var table = new Table(UnitValue.CreatePercentArray(3)).UseAllAvailableWidth();
table.AddHeaderCell(new Cell().Add(new Paragraph("ID")));
table.AddHeaderCell(new Cell().Add(new Paragraph("Name")));
// ... many more lines
' iText approach
document.Add(New Paragraph("Title") _
    .SetTextAlignment(TextAlignment.CENTER) _
    .SetFontSize(24) _
    .SetBold())

Dim table = New Table(UnitValue.CreatePercentArray(3)).UseAllAvailableWidth()
table.AddHeaderCell(New Cell().Add(New Paragraph("ID")))
table.AddHeaderCell(New Cell().Add(New Paragraph("Name")))
' ... many more lines
$vbLabelText   $csharpLabel

IronPDFはHTMLとCSSを使用しています:

//IronPDFapproach
string html = @"
    <style>
        h1 { text-align: center; font-size: 24px; font-weight: bold; }
        table { width: 100%; border-collapse: collapse; }
        th { background-color: #4CAF50; color: white; padding: 8px; }
    </style>
    <h1>Title</h1>
    <table>
        <tr><th>ID</th><th>Name</th></tr>
    </table>";

var pdf = renderer.RenderHtmlAsPdf(html);
//IronPDFapproach
string html = @"
    <style>
        h1 { text-align: center; font-size: 24px; font-weight: bold; }
        table { width: 100%; border-collapse: collapse; }
        th { background-color: #4CAF50; color: white; padding: 8px; }
    </style>
    <h1>Title</h1>
    <table>
        <tr><th>ID</th><th>Name</th></tr>
    </table>";

var pdf = renderer.RenderHtmlAsPdf(html);
'IronPDFapproach
Dim html As String = "
    <style>
        h1 { text-align: center; font-size: 24px; font-weight: bold; }
        table { width: 100%; border-collapse: collapse; }
        th { background-color: #4CAF50; color: white; padding: 8px; }
    </style>
    <h1>Title</h1>
    <table>
        <tr><th>ID</th><th>Name</th></tr>
    </table>"

Dim pdf = renderer.RenderHtmlAsPdf(html)
$vbLabelText   $csharpLabel

AGPLライセンスは廃止されました

iTextのAGPLライセンスでは、Webアプリケーション全体をオープンソース化するか、高価な商用ライセンスを購入する必要があります。 IronPdfの商用ライセンスにより、ウイルスライセンス要件なしにプロプライエタリなソフトウェアに導入することができます。

pdfHTMLアドオンは必要ありません

iTextはHTMLからPDFへの変換のためにpdfHTMLアドオンが必要です。IronPdfにはChromiumベースのHTMLレンダリング機能が含まれています。

メソッド置換パターン

iTextパターン IronPDFの置き換え
SetTextAlignment(TextAlignment.CENTER) CSS text-align: center
SetFontSize(24) CSS font-size: 24px
SetBold() CSS font-weight: bold
new Table(3) HTML <table>
AddHeaderCell(new Cell().Add(new Paragraph())) HTML <th>
AddCell(new Cell().Add(new Paragraph())) HTML <td>

トラブルシューティング

問題 1: PdfWriter/Document パターン

問題:コードでは、PdfWriterPdfDocumentDocument のネスト パターンが使用されています。

解決策: ChromePdfRenderer に置き換えます。

// Delete this iText pattern:
// using (var writer = new PdfWriter(outputPath))
// using (var pdfDoc = new PdfDocument(writer))
// using (var document = new Document(pdfDoc))

// Replace with:
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs(outputPath);
// Delete this iText pattern:
// using (var writer = new PdfWriter(outputPath))
// using (var pdfDoc = new PdfDocument(writer))
// using (var document = new Document(pdfDoc))

// Replace with:
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs(outputPath);
Imports IronPdf

Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs(outputPath)
$vbLabelText   $csharpLabel

課題2:HtmlConverterが見つかりません

問題:コードは pdfHTML アドオンを必要とする iText.Html2pdf.HtmlConverter を使用します。

解決策:IronPDFの組み込み HTML レンダリングを使用します。

// iText (requires pdfHTML add-on)
HtmlConverter.ConvertToPdf(html, fileStream);

//IronPDF(built-in)
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs(outputPath);
// iText (requires pdfHTML add-on)
HtmlConverter.ConvertToPdf(html, fileStream);

//IronPDF(built-in)
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs(outputPath);
' iText (requires pdfHTML add-on)
HtmlConverter.ConvertToPdf(html, fileStream)

' IronPDF(built-in)
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs(outputPath)
$vbLabelText   $csharpLabel

問題 3: PdfMerger の複雑さ

問題: iText の PdfMerger では、ネストされたリーダーとページ範囲の指定が必要です。

解決策:IronPDFの静的マージメソッドを使用します。

// iText merger pattern (delete this)
// using (PdfDocument pdfDoc = new PdfDocument(writer))
// {
//     PdfMerger merger = new PdfMerger(pdfDoc);
//     foreach (string file in inputFiles)
//     {
//         using (PdfDocument sourcePdf = new PdfDocument(new PdfReader(file)))
//         {
//             merger.Merge(sourcePdf, 1, sourcePdf.GetNumberOfPages());
//         }
//     }
// }

//IronPDF(simple)
var merged = PdfDocument.Merge(pdfDocuments);
merged.SaveAs("merged.pdf");
// iText merger pattern (delete this)
// using (PdfDocument pdfDoc = new PdfDocument(writer))
// {
//     PdfMerger merger = new PdfMerger(pdfDoc);
//     foreach (string file in inputFiles)
//     {
//         using (PdfDocument sourcePdf = new PdfDocument(new PdfReader(file)))
//         {
//             merger.Merge(sourcePdf, 1, sourcePdf.GetNumberOfPages());
//         }
//     }
// }

//IronPDF(simple)
var merged = PdfDocument.Merge(pdfDocuments);
merged.SaveAs("merged.pdf");
Imports System.Collections.Generic

' iText merger pattern (delete this)
' Using pdfDoc As New PdfDocument(writer)
'     Dim merger As New PdfMerger(pdfDoc)
'     For Each file As String In inputFiles
'         Using sourcePdf As New PdfDocument(New PdfReader(file))
'             merger.Merge(sourcePdf, 1, sourcePdf.GetNumberOfPages())
'         End Using
'     Next
' End Using

' IronPDF(simple)
Dim merged = PdfDocument.Merge(pdfDocuments)
merged.SaveAs("merged.pdf")
$vbLabelText   $csharpLabel

移行チェックリスト

移行前

  • コードベース内のすべての iText API 呼び出しをインベントリする
  • プログラムによる PDF 構築パターン (段落、表、セル) を識別する
  • ドキュメント HtmlConverter の使用法 (pdfHTML アドオン)
  • AGPLコンプライアンスリスクを評価する
  • IronPDFライセンスキーを取得する

コードの移行

  • iText NuGetパッケージを削除します: dotnet remove package itext7 -IronPDFNuGetパッケージをインストールします: dotnet add package IronPdf
  • 名前空間のインポートを更新します (using iText.*using IronPdf)
  • Document パターンを ChromePdfRenderer に置き換えます
  • Cell を HTML 要素に変換します
  • HtmlConverter.ConvertToPdf()RenderHtmlAsPdf() に置き換えます
  • マージ操作を PdfDocument.Merge() に更新します
  • 起動時にライセンスキーの初期化を追加

テスティング

  • すべてのPDF生成パスをテストする
  • 視覚的な出力が期待通りであることを確認する
  • 複雑なHTML/CSSコンテンツでテストする
  • ベンチマークパフォーマンス

移行後

  • iTextのライセンスファイルと参照を削除します
  • ドキュメントの更新
  • iTextサブスクリプションをキャンセルする(該当する場合)
  • レガシー iText コードをアーカイブする

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

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

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

アイアンサポートチーム

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