比較

iTextとIronPDFの比較:技術比較ガイド

この比較では、開発者とアーキテクトが.NET PDFのニーズに対して十分な情報を得た上で意思決定できるように、関連する技術的側面にわたって両ライブラリを比較します。

iText/iTextSharpの概要

iTextはデュアルライセンスのPDFライブラリで、ゼロからPDFを作成したり、既存のドキュメントを変更したり、テキストや画像、セキュリティ機能の追加などのタスクを実行したりすることができます。 このライブラリは、PdfWriterPdfDocumentDocumentParagraphTableCellなどのクラスを使用してPDFコンテンツを構築する、プログラムAPIアプローチを使用しています。

iText 7 は、iText.Kernel.PdfiText.LayoutiText.Layout.ElementiText.Html2pdf などの名前空間を使用します。 PDFの作成では、PdfWriterを作成し、それをPdfDocumentでラップし、コンテンツレイアウトのためにDocumentを作成します。 テキストはParagraphオブジェクトを介して、テーブルはTableCellオブジェクトを介して、画像はImageDataFactoryImageクラスを介して追加されます。

HTMLからPDFへの変換には、iTextは、HtmlConverter.ConvertToPdf()メソッドでiText.Html2pdf名前空間を介して利用可能な、個別のpdfHTMLアドオンを必要とします。 このアドオンは別途有料で販売しています。

iTextはAGPLライセンスで提供されており、ウェブアプリケーションにAGPLコードを組み込んだソフトウェアはオープンソースとしてリリースされるか、開発者が商用ライセンスを購入する必要があります。 iTextは永久ライセンスを廃止しており、商用利用には年間サブスクリプションの更新が必要です。

IronPDFの概要

IronPDFはプログラムによるPDF作成よりもHTMLやCSSでの作業を好む.NET開発者のためにデザインされた商用PDFライブラリです。 このライブラリは最新のChromiumレンダリングエンジンを使用しており、HTML5、CSS3、JavaScript、およびFlexboxやGridのような最新のレイアウトシステムを正確にレンダリングします。

IronPDFはRenderHtmlAsPdf()RenderUrlAsPdf()RenderHtmlFileAsPdf()のようなメソッドを持つChromePdfRendererクラスを主要なPDF生成メカニズムとして使用します。 このライブラリは、SaveAs()で保存したり、BinaryDataとしてアクセスできるPdfDocumentオブジェクトを返します。 コンフィギュレーションは、用紙サイズ、マージン、ヘッダー、フッターにRenderingOptionsプロパティを使用します。

IronPDFは永続ライセンスとサブスクリプションライセンスの両方を提供しており、バイラルライセンスの要件はありません。 HTMLからPDFへの変換は、個別のアドオンを必要とせず、基本製品に組み込まれています。

ライセンスとビジネス モデルの比較

これらのライブラリの最も大きな違いは、ライセンスとビジネスへの影響です。

フィーチャーiText 7 / iTextSharpIronPDF
ライセンスAGPL(バイラル)または高価なサブスクリプション商用、永久オプション
HTMLからPDFへ別途pdfHTMLアドオン(有料)内蔵Chromiumレンダラー
オープンソースリスクAGPLの下でオープンソースのウェブアプリケーションを提供すること。ウイルス要件なし
価格設定モデルサブスクリプションのみ永久またはサブスクリプション
永久オプション排除利用可能

AGPLライセンスの罠は、商用ウェブアプリケーションにとって特に問題となります。 商用ライセンスを購入せずにiTextをWebアプリケーションで使用する場合、AGPLは、PDFコードだけでなく、コードベース全体ではなく、アプリケーション全体をオープンソースにすることを要求します。

APIパラダイムの比較

基本的なAPIの設計思想は、ライブラリによって大きく異なります。

アスペクトiTextIronPDF
APIパラダイムプログラム(段落、表、セル)CSSによるHTMLファースト
CSSサポート基本的なCSS(pdfHTMLアドオン経由)フルCSS3、フレックスボックス、グリッド
JavaScript(ジャバスクリプトなし完全な実行
ラーニングカーブスティープ(PDF座標系)ウェブ開発者フレンドリー
コンテンツ構築マニュアル低レベルオブジェクトHTMLテンプレート

iTextは、明示的なオブジェクト構築によってプログラムでPDFを構築します。 IronPDFはHTML/CSSを使用しているため、ウェブ開発者は既存のスキルをそのまま適用することができます。

コードの比較:一般的なPDF操作

HTMLからPDFへの変換

最も基本的な操作では、さまざまなアプローチとアドオンの要件を示します。

iText(pdfHTMLアドオンが必要です):

// 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を作成し、ストリームに直接書き込むためにHtmlConverter.ConvertToPdf()を呼び出します。

IronPDFはChromePdfRendererを作成し、HTML文字列でRenderHtmlAsPdf()を呼び出し、SaveAs()で保存します。 Chromiumエンジンは、アドオンを追加することなく、CSS3とJavaScriptを完全にサポートします。

高度なHTMLレンダリングオプションについては、HTMLからPDFへの変換ガイドをご覧ください。

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

プログラムによるPDFの構築は、パラダイムの違いを最も明確に示しています。

iテキスト:

// 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では、PdfWriterを作成し、それをPdfDocumentでラップし、レイアウト用にDocumentを作成し、ParagraphオブジェクトとImageDataFactoryで作成したImageオブジェクトを追加する必要があります。 各要素には、明示的な構築と設定が必要です。

IronPDFは標準的なHTML-見出し、段落、<img>タグ-を使用します。 Chromiumエンジンがレンダリングを処理するため、大幅に少ないコードで同じ結果が得られます。

複数のPDFをマージする

ドキュメントのマージは、APIの複雑さの違いを示しています。

iテキスト:

// 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を作成し、ソースファイルを反復してPdfReaderPdfDocumentのインスタンスを作成し、ページ範囲を使ってmerger.Merge()を呼び出し、すべてのオブジェクトの廃棄を管理する必要があります。

IronPDFはPdfDocument.FromFile()でドキュメントをロードし、リストを作成し、静的なPdfDocument.Merge()メソッドを呼び出します。 操作はかなり簡潔です。

PDF操作についてはIronPDFチュートリアルをご覧ください。

APIマッピングリファレンス

iText の移行を評価したり、機能を比較したりする開発者向けに、同等の操作を示すマッピングです:

クラスマッピング

iText 7 クラスiTextSharpクラスIronPDF 同等物
PdfWriter</codePdfWriter</codeChromePdfRenderer</code
PdfDocument</codeドキュメント</codePdfDocument</code
ドキュメント</codeドキュメント</codeChromePdfRenderer.RenderHtmlAsPdf()のようになります。
段落</code段落</codeHTML <p><h1>など。
表</codePdfPTable</codeHTML <テーブル></code
セル</codePdfPCell</codeHTML <td><th>
イメージ</codeイメージ</codeHTML <img>
リスト</codeリスト</codeHTML <ul><ol>
リストアイテム</codeリストアイテム</codeHTML <li>
PdfReader</codePdfReader</codePdfDocument.FromFile()を使用してください。
PdfMerger</code該当なしPdfDocument.Merge()を使用してください。
PdfTextExtractor</codePdfTextExtractor</codepdf.ExtractAllText()を使用してください。

メソッドマッピング

タスクiText7IronPDF
HTMLからPDFを作成HtmlConverter.ConvertToPdf()を使用してください。renderer.RenderHtmlAsPdf()</code
URLからPDFを作成HTMLのダウンロード + 変換renderer.RenderUrlAsPdf()を使用してください。
ファイルからPDFを作成HtmlConverter.ConvertToPdf(File.ReadAllText())renderer.RenderHtmlFileAsPdf()を使用してください。
ファイルに保存document.Close() (ストリーム経由)pdf.SaveAs()</code
バイトに保存memoryStream.ToArray()</codepdf.BinaryData</code
既存のPDFを開くnew PdfDocument(new PdfReader(path))とします。PdfDocument.FromFile()を使用してください。
PDFのマージPdfMerger.Merge()</codePdfDocument.Merge()を使用してください。
テキスト抽出PdfTextExtractor.GetTextFromPage()pdf.ExtractAllText()を使用してください。

スタイルマッピング

iText 7 メソッドIronPDF 同等物
SetTextAlignment(TextAlignment.CENTER)を設定してください。CSS text-align: center
SetFontSize(12)を設定してください。CSS フォントサイズ: 12px
SetBold()</codeCSS font-weight: bold
SetBackgroundColor()</codeCSS 背景色</code
SetBorder()</codeCSS ボーダー</code

機能比較の概要

フィーチャーiTextIronPDF
プログラムPDFの作成✅ (主なアプローチ)⚠️ (HTML経由)
HTMLからPDFへ⚠️ (pdfHTML アドオンが必要です)✅ (ビルトイン)
CSS3 サポート⚠️ (pdfHTML による基本)✅ (フル)
フレックスボックス/グリッド
JavaScriptの実行
PDFマージ✅ (PdfMerger)✅ (PdfDocument.Merge())
テキスト抽出✅ (PdfTextExtractor)✅ (ExtractAllText())
永久ライセンス❌ (削除)
AGPLリスクなし❌ (AGPLまたはサブスクリプション)
コミュニティサポート✅ (広範囲)

チームがiTextからIronPDFへの移行を検討するとき

開発チームがiTextからIronPDFへの移行を評価する理由はいくつかあります:

AGPLライセンスの罠: AGPLライセンスは、商用ウェブアプリケーションにとって非常に制限的です。 商用ライセンスを購入せずにiTextをWebアプリケーションで使用する場合、AGPLは、PDFコードだけでなく、コードベース全体ではなく、アプリケーション全体をオープンソースにすることを要求します。 プロプライエタリなソフトウェアを開発しているチームは、多くの場合、このウイルスライセンス要件を受け入れることができません。

サブスクリプションのみの商用ライセンス: iTextは永久ライセンスを廃止し、商用利用には年間サブスクリプションの更新が必要です。 1回限りの購入を希望するチームは、IronPDFの永久ライセンスオプションの方が予算に適していることに気づくでしょう。

pdfHTMLアドオンのコスト:iTextでHTMLをPDFに変換するには、開発者は別途pdfHTMLアドオンに投資しなければなりません。 IronPDFは最新のChromiumレンダリングエンジンとHTMLからPDFへの変換を基本製品に含んでいます。

プログラムAPIの複雑さ: iTextでは、ParagraphTableCell、およびその他のオブジェクトを使用して、低レベルのPDFを手動で作成する必要があります。 ウェブ開発経験のあるチームはIronPDFのHTML/CSSアプローチがより直感的で生産的であると感じています。

最新のWeb標準:pdfHTMLがあっても、iTextは複雑なCSSやJavaScriptのサポートが限られています。 IronPdfのChromiumエンジンは完全なCSS3、Flexbox、グリッド、JavaScriptの実行を最新のウェブコンテンツに提供します。

簡素化されたコードベース: iTextのプログラム的アプローチからIronPDFのHTMLファーストパラダイムに変換することで、コードが大幅に少なくなることがよくあります。 TableCellParagraphオブジェクトで数十行を必要とするレポート・テーブルは、CSSスタイリングでシンプルなHTMLテーブルになります。

長所と考慮点

iTextの強み

  • 包括的な機能セット:広範なPDF操作機能
  • 幅広い採用:大規模なコミュニティと広範なドキュメント
  • クロスプラットフォーム:さまざまな.NETプラットフォームで動作します。
  • きめ細かな制御:特殊なニーズのためのPDFオブジェクトの直接操作

テキストに関する考慮事項

  • AGPLライセンス: Viralライセンスは、オープンソース・ウェブアプリケーションまたは商用サブスクリプションを必要とします。
  • サブスクリプションのみ: 永続的なライセンスは必要ありません。
  • pdfHTMLアドオン: HTML-to-PDFは別途購入が必要です。
  • プログラム的な複雑さ: PDF座標系による急な学習曲線
  • 限定的なモダンCSS: pdfHTMLでも基本的なCSSをサポートしています。
  • JavaScriptを使用しない: HTMLコンテンツでJavaScriptを実行することはできません。

IronPDFの強み

  • 永久ライセンス:1回限りの購入も可能です。
  • AGPLリスクなし: プロプライエタリなコードをクローズドソースに保つ。
  • HTML-to-PDFビルトイン:別途アドオンは必要ありません。
  • Chromiumエンジン:完全なCSS3、Flexbox、グリッド、JavaScriptのサポート。
  • ウェブ開発者に優しい:使い慣れたHTML/CSSスキルを使用します。
  • よりシンプルなAPI: 一般的な操作のための簡潔なメソッド
  • 包括的なリソース: 豊富なチュートリアルドキュメント

IronPDFについての考察

  • 商用ライセンス: 本番使用時に必要です。
  • HTMLファーストパラダイム:プログラムによる構築とは異なるアプローチ

結論

iTextとIronPDFは.NETアプリケーションでのPDF生成において根本的に異なるアプローチを示しています。 iTextは、ParagraphTableCellのようなクラスを使った包括的なプログラムによるPDF作成を提供しますが、AGPLはウェブアプリケーションのオープンソース化を要求し、永久ライセンスは廃止され、HTML-to-PDFはpdfHTMLアドオンを別途購入する必要があるなど、ライセンスに関する重大な問題を抱えています。

IronPdfは、Chromiumエンジンを使用した組み込みのHTML-to-PDF変換、永久ライセンスオプション、バイラルライセンス不要の最新の選択肢を提供します。 HTMLファーストのアプローチにより、ウェブ開発者は既存のスキルをそのまま応用することができ、よりシンプルで保守性の高いコードを作成することができます。

組織が.NET 10、C# 14、そして2026年までのアプリケーション開発を計画する中で、AGPLライセンスのプログラムによるPDF構築と商用ライセンスのHTMLベースのレンダリングのどちらを選択するかは、法令遵守と開発の生産性の両方に大きく影響します。 AGPLリスクの排除、ライセンスの複雑さの軽減、PDF生成のためのウェブ開発スキルの活用を求めるチームは、IronPDFがこれらの要件に効果的に対応することを発見するでしょう。

無料トライアルでIronPDFの評価を開始し、包括的なドキュメントを参照して、特定の要件への適合性を評価してください。