IronPDF vs ABCpdf: 2025年にどのC# PDFライブラリがより優れたHTMLからPDFへの変換を提供するか?
PDFファイルは、請求書の発行や各種文書の作成など、様々な分野で広く利用されており、顧客のニーズに効果的に応えます。 PDF 生成を必要とする.NETアプリケーションを開発する場合、適切なライブラリを選択すると、開発速度、出力品質、長期的なメンテナンス コストに大きな影響を与える可能性があります。 開発者がよく検討する 2 つのライブラリはIronPDFと ABCpdf ですが、どちらが特定のニーズに対して本当に優れた結果をもたらすのでしょうか?
この徹底的な比較では、HTML から PDF への変換精度からライセンス モデルまで、両方のライブラリの機能を検証し、情報に基づいた決定を下すのに役立ちます。 実際のパフォーマンス メトリック、API 設計哲学、各ライブラリの長所と限界を示す実用的なコード例を見ていきます。 毎日何千もの請求書を生成する SaaS プラットフォームを構築する場合でも、正確なドキュメント レンダリングを必要とするエンタープライズ アプリケーションを構築する場合でも、これらの違いを理解することはプロジェクトの成功に不可欠です。
IronPDFとは何ですか?
IronPDFは、C# ソフトウェア エンジニアが.NETプロジェクトで PDF ドキュメントを編集、抽出、生成するのに役立つ商用グレードの PDF 生成ライブラリです。 Chromeベースのレンダリングエンジンを核にして構築されたIronPDFは、HTML、CSS、およびJavaScriptを、Google Chromeでウェブページを印刷するのと同じ忠実度でPDFに変換します。
IronPDFの主な機能
IronPDFは.NET Chromiumエンジンを使用してHTMLページをPDFファイルにレンダリングします。 HTMLからPDFへでは、PDFを配置したりデザインしたりするために複雑なAPIを使用する必要はありません。 IronPDFは、標準のウェブドキュメント、すなわちHTML、ASPX、JS、CSS、および画像をサポートしています。 このライブラリのアーキテクチャは、開発者の体験を重視しながら、プロフェッショナルグレードの出力品質を維持します。
HTMLからPDFへの変換の卓越性
- HTML5セマンティック要素を含むHTMLの完全サポート
- Flexbox、Grid、モダンなレイアウト技術を含むCSS3の完全サポート
- 動的コンテンツレンダリングのため for JavaScriptの実行
- Google Fonts やカスタム
@font-face宣言を含む Web フォントのサポート - ビューポート制御によるレスポンシブデザインのレンダリング
- AJAXコンテンツの待機時間を設定可能な読み込み
ドキュメント操作機能
-結合と分割:複数のPDFを結合したり、単一のメソッド呼び出しで特定のページを抽出したりできます -ヘッダーとフッター:ページ番号、日付、カスタム HTML などの動的なコンテンツを追加します。 -透かし:不透明度と位置をコントロールしながらテキストまたは画像の透かしを適用します -フォーム管理: HTMLフォーム要素から入力可能なPDFフォームを自動的に作成します -デジタル署名:証明書管理を使用して暗号署名を適用する -暗号化:きめ細かな権限設定が可能な128ビットおよび256ビットのAES暗号化を実装
高度なレンダリング機能
-マルチスレッド処理:高性能シナリオのためのネイティブ async/await サポート -バッチ操作:複数のドキュメントを同時に処理するための最適化された方法 -メモリ効率: PDF全体をメモリにロードせずに大規模なドキュメントを生成するためのストリーミングサポート -クラウド最適化: Docker、Azure、AWS でのコンテナ化されたデプロイメント向けに設計
クロスプラットフォームアーキテクチャ
IronPDFは異なる環境で一貫した動作を維持します:
- Windows (x86/x64)
- Linux (最小のDockerイメージ用のAlpineを含む)
- macOS (IntelとApple Silicon)
- Azureアプリサービス、機能、およびコンテナインスタンス
- AWS LambdaおよびEC2
- Google Cloud Platform
ABCpdfとは何ですか?
ABCpdf .NET C# PDF ライブラリは、Adobe PDF ドキュメントの動的な読み取り、書き込み、変換、および操作を行う.NETコンポーネントです。 WebSupergooによって開発されたABCpdfは、20年以上にわたり.NETコミュニティにサービスを提供し、複数のHTMLレンダリングエンジンおよび包括的なPDF操作機能を提供しています。
ABCpdfの主な機能
ABCpdf は、HTML/CSS およびJavaScript、SVG、AJAX、Font Awesome などの関連テクノロジーを完全にサポートしています。 このライブラリは、開発者に高レベルの便利なメソッドと低レベルのPDFオブジェクトアクセスの両方を提供します。
複数のレンダリングエンジン
ABCpdfのユニークなアプローチは、次のような複数のレンダリングエンジンを提供します:
- ABCChrome エンジン:最新の Web 標準に対応する Chromium ベース (x64 のみ)
- Gecko Engine:互換性テスト用の複数のバージョン
- MSHTML エンジン: Internet Explorer ベースのレンダリング
- ABCWebKit エンジン: WebKit ベースのレンダリング (x64 のみ)
このマルチエンジンアプローチにより、開発者は特定のコンテンツに最適なレンダラーを選ぶことができますが、デプロイおよびテストの複雑さが増すこともあります。
ドキュメントインポート機能
ABCpdfは、OpenOffice.orgのような補助アプリケーションがインストールされている場合、さまざまなドキュメント形式を読み取ることができます。 1Dバーコード: Code128, Code39, Code93, Codabar, ITF, MSI, Plessey, UPCA, UPCE, EAN8, EAN13
- Microsoft Officeドキュメント (Word, Excel, PowerPoint)
- PostScriptおよびEPSファイル
- XPS (XML Paper Specification)
- SVG (縮尺可能なベクターグラフィック)
- TIFF、JPEG 2000、RAW形式を含むさまざまな画像形式
低レベルのPDF操作
- PDFオブジェクトモデルへの直接アクセス
- 複数アルゴリズムによるストリーム圧縮/解凍
- フォントのサブセット化および埋め込みの制御
- カラースペース管理および変換
- コンテンツストリーム操作
パフォーマンス機能
ABCpdfは完全にマルチスレッド対応であり、C#、ASPX、およびVBを含むさまざまな.NET環境で柔軟に使用でき、高性能なマルチスレッド設定でテストされています。 このライブラリには以下が含まれます:
- 非常に大きなドキュメント用のGigaPDF™サポート
- サーバー環境向けに最適化されたメモリ使用
- 効率的なフォントキャッシュメカニズム
- バックグラウンドスレッド処理機能
モダンCSSフレームワークサポート
現代のウェブアプリケーションで作業する際、Bootstrapベースのレイアウトおよびその他のモダンCSSフレームワークをPDFに変換する能力はますます重要になります。 多くの企業アプリケーションおよびSaaSプラットフォームは、UIの一貫性のためにBootstrapに依存しており、PDF生成はこれらのレイアウトを完璧に保つ必要があります。
IronPDF: 全Bootstrapおよびモダンフレームワーク対応
IronPDFのChromiumレンダリングエンジンは、モダンCSSフレームワークの包括的なサポートを提供します:
- Bootstrap 5:フレックスボックスベースのレイアウト、グリッドシステム、レスポンシブユーティリティを完全にサポート
- Bootstrap 4:フレックスボックスカードデッキ、ナビゲーションバー、フォームレイアウトとの完全な互換性
- Tailwind CSS:最新のユーティリティファーストCSSフレームワークは完璧にレンダリングします -基盤:すべてのグリッドおよびコンポーネント システムをサポート -モダン CSS3: Flexbox、CSS グリッド、アニメーション、トランジション、カスタムプロパティ
実際の例: BootstrapのホームページおよびBootstrapテンプレートはピクセル完璧な精度でPDFに変換されます。
コード例: E-Commerce Product Grid
using IronPdf;
var renderer = new ChromePdfRenderer();
string bootstrapProductGrid = @"
<!DOCTYPE html>
<html>
<head>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
<div class='container my-5'>
<h1 class='mb-4'>Product Catalog</h1>
<div class='row row-cols-1 row-cols-md-3 g-4'>
<div class='col'>
<div class='card h-100'>
<img src='https://via.placeholder.com/300x200' class='card-img-top' alt='Product 1'>
<div class='card-body d-flex flex-column'>
<h5 class='card-title'>Premium Widget</h5>
<p class='card-text flex-grow-1'>High-quality widget with advanced features and excellent durability.</p>
<div class='d-flex justify-content-between align-items-center mt-auto'>
<span class='h4 mb-0 text-primary'>$99.99</span>
<button class='btn btn-primary'>Add to Cart</button>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100'>
<img src='https://via.placeholder.com/300x200' class='card-img-top' alt='Product 2'>
<div class='card-body d-flex flex-column'>
<h5 class='card-title'>Standard Widget</h5>
<p class='card-text flex-grow-1'>Reliable widget perfect for everyday use with great value.</p>
<div class='d-flex justify-content-between align-items-center mt-auto'>
<span class='h4 mb-0 text-primary'>$49.99</span>
<button class='btn btn-primary'>Add to Cart</button>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100'>
<img src='https://via.placeholder.com/300x200' class='card-img-top' alt='Product 3'>
<div class='card-body d-flex flex-column'>
<h5 class='card-title'>Basic Widget</h5>
<p class='card-text flex-grow-1'>Entry-level widget with essential features at an affordable price.</p>
<div class='d-flex justify-content-between align-items-center mt-auto'>
<span class='h4 mb-0 text-primary'>$29.99</span>
<button class='btn btn-primary'>Add to Cart</button>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(bootstrapProductGrid);
pdf.SaveAs("product-catalog.pdf");
using IronPdf;
var renderer = new ChromePdfRenderer();
string bootstrapProductGrid = @"
<!DOCTYPE html>
<html>
<head>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
<div class='container my-5'>
<h1 class='mb-4'>Product Catalog</h1>
<div class='row row-cols-1 row-cols-md-3 g-4'>
<div class='col'>
<div class='card h-100'>
<img src='https://via.placeholder.com/300x200' class='card-img-top' alt='Product 1'>
<div class='card-body d-flex flex-column'>
<h5 class='card-title'>Premium Widget</h5>
<p class='card-text flex-grow-1'>High-quality widget with advanced features and excellent durability.</p>
<div class='d-flex justify-content-between align-items-center mt-auto'>
<span class='h4 mb-0 text-primary'>$99.99</span>
<button class='btn btn-primary'>Add to Cart</button>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100'>
<img src='https://via.placeholder.com/300x200' class='card-img-top' alt='Product 2'>
<div class='card-body d-flex flex-column'>
<h5 class='card-title'>Standard Widget</h5>
<p class='card-text flex-grow-1'>Reliable widget perfect for everyday use with great value.</p>
<div class='d-flex justify-content-between align-items-center mt-auto'>
<span class='h4 mb-0 text-primary'>$49.99</span>
<button class='btn btn-primary'>Add to Cart</button>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100'>
<img src='https://via.placeholder.com/300x200' class='card-img-top' alt='Product 3'>
<div class='card-body d-flex flex-column'>
<h5 class='card-title'>Basic Widget</h5>
<p class='card-text flex-grow-1'>Entry-level widget with essential features at an affordable price.</p>
<div class='d-flex justify-content-between align-items-center mt-auto'>
<span class='h4 mb-0 text-primary'>$29.99</span>
<button class='btn btn-primary'>Add to Cart</button>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(bootstrapProductGrid);
pdf.SaveAs("product-catalog.pdf");
Imports IronPdf
Dim renderer As New ChromePdfRenderer()
Dim bootstrapProductGrid As String = "
<!DOCTYPE html>
<html>
<head>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
<div class='container my-5'>
<h1 class='mb-4'>Product Catalog</h1>
<div class='row row-cols-1 row-cols-md-3 g-4'>
<div class='col'>
<div class='card h-100'>
<img src='https://via.placeholder.com/300x200' class='card-img-top' alt='Product 1'>
<div class='card-body d-flex flex-column'>
<h5 class='card-title'>Premium Widget</h5>
<p class='card-text flex-grow-1'>High-quality widget with advanced features and excellent durability.</p>
<div class='d-flex justify-content-between align-items-center mt-auto'>
<span class='h4 mb-0 text-primary'>$99.99</span>
<button class='btn btn-primary'>Add to Cart</button>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100'>
<img src='https://via.placeholder.com/300x200' class='card-img-top' alt='Product 2'>
<div class='card-body d-flex flex-column'>
<h5 class='card-title'>Standard Widget</h5>
<p class='card-text flex-grow-1'>Reliable widget perfect for everyday use with great value.</p>
<div class='d-flex justify-content-between align-items-center mt-auto'>
<span class='h4 mb-0 text-primary'>$49.99</span>
<button class='btn btn-primary'>Add to Cart</button>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100'>
<img src='https://via.placeholder.com/300x200' class='card-img-top' alt='Product 3'>
<div class='card-body d-flex flex-column'>
<h5 class='card-title'>Basic Widget</h5>
<p class='card-text flex-grow-1'>Entry-level widget with essential features at an affordable price.</p>
<div class='d-flex justify-content-between align-items-center mt-auto'>
<span class='h4 mb-0 text-primary'>$29.99</span>
<button class='btn btn-primary'>Add to Cart</button>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>"
Dim pdf = renderer.RenderHtmlAsPdf(bootstrapProductGrid)
pdf.SaveAs("product-catalog.pdf")
出力: Bootstrap 5 のカード グリッド システム、フレックスボックスの配置、レスポンシブな間隔を備えた完璧にフォーマットされた製品カタログがすべて PDF に保存されます。
ABCpdf: フレームワーク制限のあるマルチエンジンアプローチ
ABCpdfのモダンCSSフレームワークのサポートは、選択したレンダリングエンジンによって大きく異なります:
- ABCChromeエンジン (x64のみ): IronPDFと同様に良好なBootstrapサポートを持ちますが、特定の64ビットプラットフォームの構成が必要です
- ABCWebKitエンジン (x64のみ): 限られたフレックスボックスサポート、Bootstrap 4以上のレイアウトが正しくレンダリングされない可能性があります
- Gecko Engine:中程度の CSS3 サポート、Bootstrap 3 は Bootstrap 4/5 よりも優れています
- MSHTML エンジン:従来の Internet Explorer レンダリング、Bootstrap 2.x のみ、最新のアプリケーションには推奨されません
重要な考慮事項:
- エンジン選択の複雑さがデプロイメントオーバーヘッドを増します
- 64ビットのみのエンジン (ABCChrome, ABCWebKit) がデプロイメントの柔軟性を制限します
- 一貫したBootstrapレンダリングのためにエンジン間でのテストが必要です
- エンジン選択によってフレームワーク互換性が大きく異なります
ABCpdfのマルチエンジンアーキテクチャは柔軟性を提供しますが、Bootstrapレイアウトの正しいレンダリングを確保するためには慎重なエンジン選択とテストが必要です。 BootstrapまたはモダンなCSSフレームワークに強く依存しているアプリケーションの場合、ABCChromeエンジンは最良の結果を提供しますが、x64のみのデプロイメント制約があります。
Bootstrapフレームワークの互換性の詳細は、Bootstrap & Flexbox CSSガイドを参照してください。
徹底的な機能比較
| カテゴリ | 特徴/側面 | IronPDF | ABCpdf | 主な利点 |
|---|---|---|---|---|
| **コア**アーキテクチャ | デザイン哲学 | シンプルさ第一、直感的なAPI | 柔軟性優先のマルチエンジン | IronPDF: より速い開発 |
| APIの複雑さ | `RenderHtmlAsPdf()`のような単純なメソッド。 | Docクラスによるオブジェクト指向 | IronPDF: コードが70%削減 | |
| 学習曲線 | 通常1~2時間 | 通常1~2日 | IronPDF: より迅速な導入 | |
| **プラットフォームサポート** | クロスプラットフォーム | ネイティブサポート、単一パッケージ | Windows 主要言語、Linux 限定言語 | IronPDF:真のクロスプラットフォーム |
| .NETバージョン | .NET 10、9、8、7、6、5、Core 3.1 以上、Framework 4.6.2 以上 | .NET 10、9、8、7、6、5、4.0、Framework 2.0+。 | 両方: 最新のフレームワークのサポート | |
| オペレーティングシステム | Windows、Linux、macOS、Dockerネイティブ | Windows、Linuxに限定対応 | IronPDF:より幅広いOSをサポート | |
| **HTMLからPDFへ** | レンダリングエンジン | Chrome V127+エンジン | 複数のエンジン(Chrome 123、Gecko、MSHTML) | ABCpdf:エンジンの柔軟性 |
| CSS3/HTML5 サポート | 100%Chrome対応 | エンジンにより異なる(70~100) | IronPDF:一貫したレンダリング | |
| JavaScriptの実行 | V8 JavaScriptをフルサポート | エンジン依存 | IronPDF:最新のJS機能 | |
| Webフォント | Googleフォント、@font-face、システムフォント | ABCChromeでサポート | 両方:ウェブフォント対応 | |
| **パフォーマンス** | シングルページレンダリング | 標準200-400ms | 150~300ミリ秒(ABCChrome) | ABCpdf:少し速い |
| バッチ処理 | 最適化された並列処理 | マルチスレッド対応 | IronPDF:より良い非同期サポート | |
| メモリ使用量 | 150-200MB (Chromeエンジン) | 100~150MB(エンジンによって異なります) | ABCpdf:より少ないメモリフットプリント | |
| **開発者としての経験** | ドキュメント | 豊富なチュートリアル、ビデオ、例 | 包括的なAPIドキュメント | IronPDF:その他の学習リソース |
| コード例 | すぐに実行できる100以上のサンプル | 豊富な例文 | 両方豊富な例文 | |
| インテリセンスサポート | 完全なXMLドキュメント | 包括的なインテリセンス | 両方: IDE統合 | |
| **Licensing & Pricing** | エントリーレベル | Lite: $999 (1 dev, 1 project) | 標準:$329とします。(1 dev、32ビットのみ) | ABCpdf:参入コストの削減 |
| Professional | Professional: $2,999 (10 devs, 10 projects) | Professional:$479。(1 dev, 64-bit) | IronPDF:より良いチームライセンス | |
| 再配布 | +$2,999 royalty-free | $4,790 エンタープライズライセンスエンタープライズライセンス | IronPDF:より手頃な価格 | |
| **サポート** | サポートが含まれています | はい、24時間365日のエンジニアリングサポート | はい、メールサポート | IronPDF:ライブチャットサポート |
| 納期 | < 1分(ライブチャット) | 通常24~48時間 | IronPDF:より速いレスポンス | |
| **最適**な対象 | 使用例 | 最新のウェブアプリ、SaaS、クラウドネイティブ | Windowsデスクトップ、レガシーシステム | 文脈依存 |
Visual Studioで新しいプロジェクトを作成する
コード例に入る前に、適切な開発環境を設定しましょう。 Visual Studioを開いて新しいプロジェクトを作成します:
- ファイル > 新規 > プロジェクト に移動
- "コンソールアプリケーション" (.NET Coreまたは.NET Framework) を選択
- 対象フレームワークを選択 (.NET 6.0以上推奨)
- プロジェクトに名前を付ける (例: "PdfLibraryComparison")
- 作成をクリック
新しい.NETアプリケーションをセットアップするためのVisual Studioのプロジェクト作成ダイアログ
IronPDF C#ライブラリインストール
インストール方法
IronPDFは、異なる開発フローに対応するために複数のインストールアプローチを提供します:
方法 1: NuGetパッケージマネージャーを使用する (推奨)
最も簡単な方法は、Visual Studioの統合NuGetパッケージマネージャーを介したものです:
- ソリューションエクスプローラーでプロジェクトを右クリック
- "NuGetパッケージの管理" を選択
- "参照" をクリックし、"IronPDF" を検索
- 公式のIronPDFパッケージをインストール
Visual StudioのNuGetパッケージマネージャーインターフェースを通じてIronPDFをインストールする
方法 2: パッケージマネージャーコンソール
コマンドラインツールを好む開発者向け:
Install-Package IronPdf
パッケージマネージャーコンソールを使用して、1つのコマンドでIronPDFをインストール
方法 3: 直接ダウンロード
インターネットアクセスが制限された環境用:
- NuGet.orgからダウンロード
- ローカルNuGetフィードに.nupkgファイルを追加
- ローカルフィードからインストール
方法 4: .NET CLI
.NET Core/5+プロジェクト用:
dotnet add package IronPdf
ABCpdfのインストール
インストール方法
ABCpdfは、いくつかの追加考慮事項と共に同様のインストールオプションを提供します:
方法 1: NuGetインストール
Install-Package ABCpdf -Version 13.0.0.0
ABCpdfには、異なるエディション用の個別パッケージがあることに注意してください:
ABCpdf- 標準版(32ビットのみ)ABCpdf.ABCChrome64- 64 ビット版での Chrome レンダリングに必要ABCpdf.ABCGecko- Gecko レンダリング エンジン用
方法 2: 手動インストール
- WebSupergooのウェブサイトからダウンロード
- ZIPファイルを解凍
- 適切なDLLへの参照を追加
- ネイティブ依存関係を出力ディレクトリにコピー
プラットフォーム固有の考慮事項
ABCpdfは、非Windowsプラットフォームでの追加設定が必要です:
<PackageReference Include="ABCpdf.Linux" Version="13.0.0.0" />
<PackageReference Include="ABCpdf.Linux" Version="13.0.0.0" />
これらのライブラリのHTMLからPDFへの変換の対応方法
それぞれのライブラリがHTMLからPDFへの変換にどのようにアプローチしているかの基本的な違いを理解することで、彼らのさまざまな能力とパフォーマンス特性を説明します。
IronPDFのアプローチ: Chrome-First Architecture
IronPDFは、Chrome完全なブラウザエンジンを使用して、多くの利点を提供します:
using IronPdf;
// IronPDF's approach - Chrome rendering with full browser capabilities
var renderer = new ChromePdfRenderer();
// Configure rendering to match Chrome's print preview exactly
renderer.RenderingOptions = ChromePdfRenderOptions.DefaultChrome;
// Or customize for specific needs
renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Screen;
renderer.RenderingOptions.EnableJavaScript = true;
renderer.RenderingOptions.WaitFor.RenderDelay(500); // Wait for JS execution
// Convert complex HTML with modern CSS and JavaScript
string complexHtml = @"
<!DOCTYPE html>
<html>
<head>
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;700&display=swap');
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
font-family: 'Roboto', sans-serif;
}
.card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 10px;
padding: 20px;
color: white;
box-shadow: 0 10px 20px rgba(0,0,0,0.19);
transform: translateY(0);
transition: transform 0.3s;
}
@media print {
.card { break-inside: avoid; }
}
</style>
</head>
<body>
<div class='container'>
<div class='card'>
<h2>Modern CSS Support</h2>
<p>Grid, Flexbox, Gradients, Shadows - all rendered perfectly</p>
</div>
<div class='card'>
<h2>Webフォント</h2>
<p>Google Fonts and custom fonts work seamlessly</p>
</div>
</div>
<script>
// Dynamic content generation
document.addEventListener('DOMContentLoaded', function() {
const container = document.querySelector('.container');
const dynamicCard = document.createElement('div');
dynamicCard.className = 'card';
dynamicCard.innerHTML = '<h2>JavaScript Generated</h2><p>This card was added by JavaScript</p>';
container.appendChild(dynamicCard);
});
</script>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(complexHtml);
pdf.SaveAs("modern-web-features.pdf");
using IronPdf;
// IronPDF's approach - Chrome rendering with full browser capabilities
var renderer = new ChromePdfRenderer();
// Configure rendering to match Chrome's print preview exactly
renderer.RenderingOptions = ChromePdfRenderOptions.DefaultChrome;
// Or customize for specific needs
renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Screen;
renderer.RenderingOptions.EnableJavaScript = true;
renderer.RenderingOptions.WaitFor.RenderDelay(500); // Wait for JS execution
// Convert complex HTML with modern CSS and JavaScript
string complexHtml = @"
<!DOCTYPE html>
<html>
<head>
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;700&display=swap');
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
font-family: 'Roboto', sans-serif;
}
.card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 10px;
padding: 20px;
color: white;
box-shadow: 0 10px 20px rgba(0,0,0,0.19);
transform: translateY(0);
transition: transform 0.3s;
}
@media print {
.card { break-inside: avoid; }
}
</style>
</head>
<body>
<div class='container'>
<div class='card'>
<h2>Modern CSS Support</h2>
<p>Grid, Flexbox, Gradients, Shadows - all rendered perfectly</p>
</div>
<div class='card'>
<h2>Webフォント</h2>
<p>Google Fonts and custom fonts work seamlessly</p>
</div>
</div>
<script>
// Dynamic content generation
document.addEventListener('DOMContentLoaded', function() {
const container = document.querySelector('.container');
const dynamicCard = document.createElement('div');
dynamicCard.className = 'card';
dynamicCard.innerHTML = '<h2>JavaScript Generated</h2><p>This card was added by JavaScript</p>';
container.appendChild(dynamicCard);
});
</script>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(complexHtml);
pdf.SaveAs("modern-web-features.pdf");
Imports IronPdf
' IronPDF's approach - Chrome rendering with full browser capabilities
Dim renderer As New ChromePdfRenderer()
' Configure rendering to match Chrome's print preview exactly
renderer.RenderingOptions = ChromePdfRenderOptions.DefaultChrome
' Or customize for specific needs
renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Screen
renderer.RenderingOptions.EnableJavaScript = True
renderer.RenderingOptions.WaitFor.RenderDelay(500) ' Wait for JS execution
' Convert complex HTML with modern CSS and JavaScript
Dim complexHtml As String = "
<!DOCTYPE html>
<html>
<head>
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;700&display=swap');
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
font-family: 'Roboto', sans-serif;
}
.card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 10px;
padding: 20px;
color: white;
box-shadow: 0 10px 20px rgba(0,0,0,0.19);
transform: translateY(0);
transition: transform 0.3s;
}
@media print {
.card { break-inside: avoid; }
}
</style>
</head>
<body>
<div class='container'>
<div class='card'>
<h2>Modern CSS Support</h2>
<p>Grid, Flexbox, Gradients, Shadows - all rendered perfectly</p>
</div>
<div class='card'>
<h2>Webフォント</h2>
<p>Google Fonts and custom fonts work seamlessly</p>
</div>
</div>
<script>
' Dynamic content generation
document.addEventListener('DOMContentLoaded', function() {
const container = document.querySelector('.container');
const dynamicCard = document.createElement('div');
dynamicCard.className = 'card';
dynamicCard.innerHTML = '<h2>JavaScript Generated</h2><p>This card was added by JavaScript</p>';
container.appendChild(dynamicCard);
});
</script>
</body>
</html>"
Dim pdf = renderer.RenderHtmlAsPdf(complexHtml)
pdf.SaveAs("modern-web-features.pdf")
このコードはいくつかの主要な特長を示します。IronPDFのChromeベースのアプローチ:
1.最新のCSSサポート:グリッドレイアウト、フレックスボックス、グラデーション、変形はChromeと全く同じように動作します
- Webフォントの統合: Google Fontsは追加の設定なしで自動的に読み込まれます
- JavaScriptの実行: PDFレンダリングの前に動的コンテンツの生成が行われます 4.メディアクエリ:印刷固有のスタイルが適切に適用されている
ABCpdfのアプローチ: マルチエンジンの柔軟性
ABCpdfは、異なる能力を持つ複数のレンダリングエンジンを提供します:
using WebSupergoo.ABCpdf13;
// 方法 1: Using ABCChrome engine (most modern)
Doc chromeDoc = new Doc();
chromeDoc.HtmlOptions.Engine = EngineType.Chrome;
chromeDoc.HtmlOptions.Chrome.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36");
// Chrome engine supports modern web standards
int chromeId = chromeDoc.AddImageUrl("https://example.com");
// Chain pages if content overflows
while (chromeDoc.Chainable(chromeId))
{
chromeDoc.Page = chromeDoc.AddPage();
chromeId = chromeDoc.AddImageToChain(chromeId);
}
chromeDoc.Save("chrome-engine-output.pdf");
// 方法 2: Using Gecko engine (Firefox-based)
Doc geckoDoc = new Doc();
geckoDoc.HtmlOptions.Engine = EngineType.Gecko;
geckoDoc.HtmlOptions.UseScript = true; // Enable JavaScript
// Gecko provides good standards support with lower resource usage
string html = "<html><body><h1>Gecko Rendered Content</h1></body></html>";
geckoDoc.AddImageHtml(html);
geckoDoc.Save("gecko-engine-output.pdf");
// 方法 3: Using MSHTML engine (IE-based, legacy support)
Doc ieDoc = new Doc();
ieDoc.HtmlOptions.Engine = EngineType.MSHtml;
// MSHTML is faster but with limited modern CSS support
ieDoc.AddImageUrl("https://legacy-app.example.com");
ieDoc.Save("ie-engine-output.pdf");
using WebSupergoo.ABCpdf13;
// 方法 1: Using ABCChrome engine (most modern)
Doc chromeDoc = new Doc();
chromeDoc.HtmlOptions.Engine = EngineType.Chrome;
chromeDoc.HtmlOptions.Chrome.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36");
// Chrome engine supports modern web standards
int chromeId = chromeDoc.AddImageUrl("https://example.com");
// Chain pages if content overflows
while (chromeDoc.Chainable(chromeId))
{
chromeDoc.Page = chromeDoc.AddPage();
chromeId = chromeDoc.AddImageToChain(chromeId);
}
chromeDoc.Save("chrome-engine-output.pdf");
// 方法 2: Using Gecko engine (Firefox-based)
Doc geckoDoc = new Doc();
geckoDoc.HtmlOptions.Engine = EngineType.Gecko;
geckoDoc.HtmlOptions.UseScript = true; // Enable JavaScript
// Gecko provides good standards support with lower resource usage
string html = "<html><body><h1>Gecko Rendered Content</h1></body></html>";
geckoDoc.AddImageHtml(html);
geckoDoc.Save("gecko-engine-output.pdf");
// 方法 3: Using MSHTML engine (IE-based, legacy support)
Doc ieDoc = new Doc();
ieDoc.HtmlOptions.Engine = EngineType.MSHtml;
// MSHTML is faster but with limited modern CSS support
ieDoc.AddImageUrl("https://legacy-app.example.com");
ieDoc.Save("ie-engine-output.pdf");
Imports WebSupergoo.ABCpdf13
' 方法 1: Using ABCChrome engine (most modern)
Dim chromeDoc As New Doc()
chromeDoc.HtmlOptions.Engine = EngineType.Chrome
chromeDoc.HtmlOptions.Chrome.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36")
' Chrome engine supports modern web standards
Dim chromeId As Integer = chromeDoc.AddImageUrl("https://example.com")
' Chain pages if content overflows
While chromeDoc.Chainable(chromeId)
chromeDoc.Page = chromeDoc.AddPage()
chromeId = chromeDoc.AddImageToChain(chromeId)
End While
chromeDoc.Save("chrome-engine-output.pdf")
' 方法 2: Using Gecko engine (Firefox-based)
Dim geckoDoc As New Doc()
geckoDoc.HtmlOptions.Engine = EngineType.Gecko
geckoDoc.HtmlOptions.UseScript = True ' Enable JavaScript
' Gecko provides good standards support with lower resource usage
Dim html As String = "<html><body><h1>Gecko Rendered Content</h1></body></html>"
geckoDoc.AddImageHtml(html)
geckoDoc.Save("gecko-engine-output.pdf")
' 方法 3: Using MSHTML engine (IE-based, legacy support)
Dim ieDoc As New Doc()
ieDoc.HtmlOptions.Engine = EngineType.MSHtml
' MSHTML is faster but with limited modern CSS support
ieDoc.AddImageUrl("https://legacy-app.example.com")
ieDoc.Save("ie-engine-output.pdf")
マルチエンジンアプローチは柔軟性を提供しますが、慎重な考慮が必要です:
1.エンジンの選択:開発者はコンテンツに適したエンジンを選択しなければならない 2.機能の同等性:異なるエンジンは異なるHTML/CSS機能をサポートする 3.導入の複雑さ:各エンジンには異なるランタイム要件がある可能性がある 4.テストのオーバーヘッド:エンジンによって出力が異なる場合があり、より多くのテストが必要になる
URLからPDFドキュメントを作成する
PDFライブラリの最も一般的なユースケースの1つは、ライブウェブページをPDFドキュメントに変換することです。 それぞれのライブラリがこのタスクをどのように処理するかを見てみましょう。
IronPDFを使用する
IronPDFのURLからPDFへの変換は、完全なChromeブラウザエンジンを活用しています:
using IronPdf;
using System;
using System.Threading.Tasks;
public class UrlToPdfConverter
{
public static async Task ConvertUrlToPdfAsync()
{
var renderer = new ChromePdfRenderer();
// Configure for optimal web page capture
renderer.RenderingOptions = new ChromePdfRenderOptions
{
// Viewport and scaling
ViewPortWidth = 1920,
ViewPortHeight = 1080,
ZoomLevel = 100,
// Paper and margins
PaperSize = PdfPaperSize.A4,
MarginTop = 10,
MarginBottom = 10,
MarginLeft = 10,
MarginRight = 10,
// Rendering behavior
CssMediaType = PdfCssMediaType.Screen,
PrintHtmlBackgrounds = true,
CreatePdfFormsFromHtml = true,
// JavaScript and timing
EnableJavaScript = true,
WaitFor = new WaitFor
{
// Wait strategies for dynamic content
RenderDelay = 500, // milliseconds
JavaScriptFinishDelay = 100,
AllowedExecutionTime = 30000 // 30 seconds max
}
};
// Handle authentication if needed
renderer.RenderingOptions.HttpOptions.HttpHeaders.Add("Authorization", "Bearer your-token");
// Convert with error handling
try
{
// Async conversion for better performance
var pdf = await renderer.RenderUrlAsPdfAsync("https://github.com/trending");
// Add metadata
pdf.MetaData.Author = "IronPDF Example";
pdf.MetaData.Title = "GitHub Trending Projects";
pdf.MetaData.CreationDate = DateTime.Now;
// Add watermark
pdf.ApplyWatermark("<h2 style='color:red;opacity:0.5'>CONFIDENTIAL</h2>",
30, VerticalAlignment.Middle, HorizontalAlignment.Center);
pdf.SaveAs("github-trending.pdf");
Console.WriteLine("PDF created successfully!");
}
catch (Exception ex)
{
Console.WriteLine($"Error creating PDF: {ex.Message}");
}
}
}
using IronPdf;
using System;
using System.Threading.Tasks;
public class UrlToPdfConverter
{
public static async Task ConvertUrlToPdfAsync()
{
var renderer = new ChromePdfRenderer();
// Configure for optimal web page capture
renderer.RenderingOptions = new ChromePdfRenderOptions
{
// Viewport and scaling
ViewPortWidth = 1920,
ViewPortHeight = 1080,
ZoomLevel = 100,
// Paper and margins
PaperSize = PdfPaperSize.A4,
MarginTop = 10,
MarginBottom = 10,
MarginLeft = 10,
MarginRight = 10,
// Rendering behavior
CssMediaType = PdfCssMediaType.Screen,
PrintHtmlBackgrounds = true,
CreatePdfFormsFromHtml = true,
// JavaScript and timing
EnableJavaScript = true,
WaitFor = new WaitFor
{
// Wait strategies for dynamic content
RenderDelay = 500, // milliseconds
JavaScriptFinishDelay = 100,
AllowedExecutionTime = 30000 // 30 seconds max
}
};
// Handle authentication if needed
renderer.RenderingOptions.HttpOptions.HttpHeaders.Add("Authorization", "Bearer your-token");
// Convert with error handling
try
{
// Async conversion for better performance
var pdf = await renderer.RenderUrlAsPdfAsync("https://github.com/trending");
// Add metadata
pdf.MetaData.Author = "IronPDF Example";
pdf.MetaData.Title = "GitHub Trending Projects";
pdf.MetaData.CreationDate = DateTime.Now;
// Add watermark
pdf.ApplyWatermark("<h2 style='color:red;opacity:0.5'>CONFIDENTIAL</h2>",
30, VerticalAlignment.Middle, HorizontalAlignment.Center);
pdf.SaveAs("github-trending.pdf");
Console.WriteLine("PDF created successfully!");
}
catch (Exception ex)
{
Console.WriteLine($"Error creating PDF: {ex.Message}");
}
}
}
Imports IronPdf
Imports System
Imports System.Threading.Tasks
Public Class UrlToPdfConverter
Public Shared Async Function ConvertUrlToPdfAsync() As Task
Dim renderer = New ChromePdfRenderer()
' Configure for optimal web page capture
renderer.RenderingOptions = New ChromePdfRenderOptions With {
.ViewPortWidth = 1920,
.ViewPortHeight = 1080,
.ZoomLevel = 100,
.PaperSize = PdfPaperSize.A4,
.MarginTop = 10,
.MarginBottom = 10,
.MarginLeft = 10,
.MarginRight = 10,
.CssMediaType = PdfCssMediaType.Screen,
.PrintHtmlBackgrounds = True,
.CreatePdfFormsFromHtml = True,
.EnableJavaScript = True,
.WaitFor = New WaitFor With {
.RenderDelay = 500,
.JavaScriptFinishDelay = 100,
.AllowedExecutionTime = 30000
}
}
' Handle authentication if needed
renderer.RenderingOptions.HttpOptions.HttpHeaders.Add("Authorization", "Bearer your-token")
' Convert with error handling
Try
' Async conversion for better performance
Dim pdf = Await renderer.RenderUrlAsPdfAsync("https://github.com/trending")
' Add metadata
pdf.MetaData.Author = "IronPDF Example"
pdf.MetaData.Title = "GitHub Trending Projects"
pdf.MetaData.CreationDate = DateTime.Now
' Add watermark
pdf.ApplyWatermark("<h2 style='color:red;opacity:0.5'>CONFIDENTIAL</h2>", 30, VerticalAlignment.Middle, HorizontalAlignment.Center)
pdf.SaveAs("github-trending.pdf")
Console.WriteLine("PDF created successfully!")
Catch ex As Exception
Console.WriteLine($"Error creating PDF: {ex.Message}")
End Try
End Function
End Class
実証される主な機能:
-ビューポートコントロール:レスポンシブテストのためにさまざまな画面サイズをシミュレートします -認証サポート:保護されたリソースのヘッダーを追加 -動的コンテンツ処理: JavaScript を多用するページの待機戦略 -後処理:変換後にメタデータと透かしを追加します
ABCpdfを使用する
ABCpdfのURL変換はページチェーンニングを伴います:
using WebSupergoo.ABCpdf13;
using System;
public class ABCpdfUrlConverter
{
public static void ConvertUrlWithABCpdf()
{
using (Doc theDoc = new Doc())
{
// Configure the HTML engine
theDoc.HtmlOptions.Engine = EngineType.Chrome;
theDoc.HtmlOptions.Chrome.LoadDelay = 1000; // Wait 1 second
// Set viewport size
theDoc.HtmlOptions.BrowserWidth = 1200;
// Authentication
theDoc.HtmlOptions.HttpAdditionalHeaders = "Authorization: Bearer your-token";
// Page setup
theDoc.Rect.Inset(20, 20);
theDoc.Page = theDoc.AddPage();
// Add the URL
int theID = theDoc.AddImageUrl("https://github.com/trending");
// Chain pages for overflow content
while (true)
{
if (!theDoc.Chainable(theID))
break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
// Reduce file size
for (int i = 1; i <= theDoc.PageCount; i++)
{
theDoc.PageNumber = i;
theDoc.Flatten();
}
// Save
theDoc.Save("abcpdf-github.pdf");
}
}
}
using WebSupergoo.ABCpdf13;
using System;
public class ABCpdfUrlConverter
{
public static void ConvertUrlWithABCpdf()
{
using (Doc theDoc = new Doc())
{
// Configure the HTML engine
theDoc.HtmlOptions.Engine = EngineType.Chrome;
theDoc.HtmlOptions.Chrome.LoadDelay = 1000; // Wait 1 second
// Set viewport size
theDoc.HtmlOptions.BrowserWidth = 1200;
// Authentication
theDoc.HtmlOptions.HttpAdditionalHeaders = "Authorization: Bearer your-token";
// Page setup
theDoc.Rect.Inset(20, 20);
theDoc.Page = theDoc.AddPage();
// Add the URL
int theID = theDoc.AddImageUrl("https://github.com/trending");
// Chain pages for overflow content
while (true)
{
if (!theDoc.Chainable(theID))
break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
// Reduce file size
for (int i = 1; i <= theDoc.PageCount; i++)
{
theDoc.PageNumber = i;
theDoc.Flatten();
}
// Save
theDoc.Save("abcpdf-github.pdf");
}
}
}
Imports WebSupergoo.ABCpdf13
Imports System
Public Class ABCpdfUrlConverter
Public Shared Sub ConvertUrlWithABCpdf()
Using theDoc As New Doc()
' Configure the HTML engine
theDoc.HtmlOptions.Engine = EngineType.Chrome
theDoc.HtmlOptions.Chrome.LoadDelay = 1000 ' Wait 1 second
' Set viewport size
theDoc.HtmlOptions.BrowserWidth = 1200
' Authentication
theDoc.HtmlOptions.HttpAdditionalHeaders = "Authorization: Bearer your-token"
' Page setup
theDoc.Rect.Inset(20, 20)
theDoc.Page = theDoc.AddPage()
' Add the URL
Dim theID As Integer = theDoc.AddImageUrl("https://github.com/trending")
' Chain pages for overflow content
Do
If Not theDoc.Chainable(theID) Then
Exit Do
End If
theDoc.Page = theDoc.AddPage()
theID = theDoc.AddImageToChain(theID)
Loop
' Reduce file size
For i As Integer = 1 To theDoc.PageCount
theDoc.PageNumber = i
theDoc.Flatten()
Next i
' Save
theDoc.Save("abcpdf-github.pdf")
End Using
End Sub
End Class
注目すべき相違点:
-ページチェーン:複数ページのコンテンツを手動で処理する
-エンジン構成:レンダリングエンジンを明示的に選択する必要があります
-リソース管理: using ステートメントによる適切な廃棄が必要です
HTML文字列からPDFを作成する
どちらのライブラリもHTML文字列のPDFへの変換に優れていますが、アプローチは大きく異なります。
IronPDFを使用する
IronPDFのHTML文字列変換は高度な機能を持っています:
using IronPdf;
using System.IO;
public class HtmlStringToPdf
{
public static void GenerateInvoicePdf()
{
var renderer = new ChromePdfRenderer();
// Configure for print-quality output
renderer.RenderingOptions = new ChromePdfRenderOptions
{
PaperSize = PdfPaperSize.A4,
DPI = 300, // High quality print
CssMediaType = PdfCssMediaType.Print,
PaperFit = new PaperFit
{
UseFitToPageRendering = true,
RenderScale = 100
}
};
// Professional invoice HTML
string invoiceHtml = @"
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<style>
@page {
size: A4;
margin: 0;
}
body {
font-family: 'Segoe UI', Arial, sans-serif;
margin: 0;
padding: 20mm;
color: #333;
}
.invoice-header {
display: flex;
justify-content: space-between;
align-items: start;
margin-bottom: 30px;
border-bottom: 2px solid #0066cc;
padding-bottom: 20px;
}
.company-info h1 {
color: #0066cc;
margin: 0;
font-size: 28px;
}
.invoice-details {
text-align: right;
}
.invoice-details h2 {
color: #666;
margin: 0 0 10px 0;
font-size: 24px;
}
.invoice-table {
width: 100%;
border-collapse: collapse;
margin-top: 30px;
}
.invoice-table th {
background-color: #0066cc;
color: white;
padding: 12px;
text-align: left;
}
.invoice-table td {
padding: 12px;
border-bottom: 1px solid #ddd;
}
.invoice-table tr:hover {
background-color: #f5f5f5;
}
.total-section {
margin-top: 30px;
text-align: right;
}
.total-section .total-row {
display: flex;
justify-content: flex-end;
margin: 5px 0;
}
.total-section .label {
font-weight: bold;
margin-right: 20px;
min-width: 100px;
}
.total-section .grand-total {
font-size: 20px;
color: #0066cc;
border-top: 2px solid #0066cc;
padding-top: 10px;
margin-top: 10px;
}
@media print {
.no-print { display: none; }
}
</style>
</head>
<body>
<div class='invoice-header'>
<div class='company-info'>
<h1>ACME Corporation</h1>
<p>123 Business Street<br>
New York, NY 10001<br>
Phone: (555) 123-4567<br>
Email: billing@acme.com</p>
</div>
<div class='invoice-details'>
<h2>INVOICE</h2>
<p><strong>Invoice #:</strong> INV-2025-001<br>
<strong>Date:</strong> " + DateTime.Now.ToString("MMMM dd, yyyy") + @"<br>
<strong>Due Date:</strong> " + DateTime.Now.AddDays(30).ToString("MMMM dd, yyyy") + @"</p>
</div>
</div>
<div class='billing-info'>
<h3>Bill To:</h3>
<p>John Doe<br>
456 Client Avenue<br>
Los Angeles, CA 90001</p>
</div>
<table class='invoice-table'>
<thead>
<tr>
<th>Description</th>
<th>Quantity</th>
<th>Unit Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>Professional Services - Web Development</td>
<td>40 hours</td>
<td>$150.00</td>
<td>$6,000.00</td>
</tr>
<tr>
<td>Hosting Services (Annual)</td>
<td>1</td>
<td>$1,200.00</td>
<td>$1,200.00</td>
</tr>
<tr>
<td>Domain Registration</td>
<td>2</td>
<td>$15.00</td>
<td>$30.00</td>
</tr>
</tbody>
</table>
<div class='total-section'>
<div class='total-row'>
<span class='label'>Subtotal:</span>
<span>$7,230.00</span>
</div>
<div class='total-row'>
<span class='label'>Tax (8%):</span>
<span>$578.40</span>
</div>
<div class='total-row grand-total'>
<span class='label'>Total Due:</span>
<span>$7,808.40</span>
</div>
</div>
<div class='footer' style='margin-top: 50px; padding-top: 20px; border-top: 1px solid #ddd; text-align: center; color: #666;'>
<p>Thank you for your business!<br>
Payment is due within 30 days. Please include invoice number with payment.</p>
</div>
</body>
</html>";
// Generate PDF with base path for local assets
var pdf = renderer.RenderHtmlAsPdf(invoiceHtml, @"C:\Assets\");
// Add security
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights;
pdf.SecuritySettings.OwnerPassword = "admin123";
// Save with optimization
pdf.CompressImages(60); // 60% quality for smaller file size
pdf.SaveAs("professional-invoice.pdf");
}
}
using IronPdf;
using System.IO;
public class HtmlStringToPdf
{
public static void GenerateInvoicePdf()
{
var renderer = new ChromePdfRenderer();
// Configure for print-quality output
renderer.RenderingOptions = new ChromePdfRenderOptions
{
PaperSize = PdfPaperSize.A4,
DPI = 300, // High quality print
CssMediaType = PdfCssMediaType.Print,
PaperFit = new PaperFit
{
UseFitToPageRendering = true,
RenderScale = 100
}
};
// Professional invoice HTML
string invoiceHtml = @"
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<style>
@page {
size: A4;
margin: 0;
}
body {
font-family: 'Segoe UI', Arial, sans-serif;
margin: 0;
padding: 20mm;
color: #333;
}
.invoice-header {
display: flex;
justify-content: space-between;
align-items: start;
margin-bottom: 30px;
border-bottom: 2px solid #0066cc;
padding-bottom: 20px;
}
.company-info h1 {
color: #0066cc;
margin: 0;
font-size: 28px;
}
.invoice-details {
text-align: right;
}
.invoice-details h2 {
color: #666;
margin: 0 0 10px 0;
font-size: 24px;
}
.invoice-table {
width: 100%;
border-collapse: collapse;
margin-top: 30px;
}
.invoice-table th {
background-color: #0066cc;
color: white;
padding: 12px;
text-align: left;
}
.invoice-table td {
padding: 12px;
border-bottom: 1px solid #ddd;
}
.invoice-table tr:hover {
background-color: #f5f5f5;
}
.total-section {
margin-top: 30px;
text-align: right;
}
.total-section .total-row {
display: flex;
justify-content: flex-end;
margin: 5px 0;
}
.total-section .label {
font-weight: bold;
margin-right: 20px;
min-width: 100px;
}
.total-section .grand-total {
font-size: 20px;
color: #0066cc;
border-top: 2px solid #0066cc;
padding-top: 10px;
margin-top: 10px;
}
@media print {
.no-print { display: none; }
}
</style>
</head>
<body>
<div class='invoice-header'>
<div class='company-info'>
<h1>ACME Corporation</h1>
<p>123 Business Street<br>
New York, NY 10001<br>
Phone: (555) 123-4567<br>
Email: billing@acme.com</p>
</div>
<div class='invoice-details'>
<h2>INVOICE</h2>
<p><strong>Invoice #:</strong> INV-2025-001<br>
<strong>Date:</strong> " + DateTime.Now.ToString("MMMM dd, yyyy") + @"<br>
<strong>Due Date:</strong> " + DateTime.Now.AddDays(30).ToString("MMMM dd, yyyy") + @"</p>
</div>
</div>
<div class='billing-info'>
<h3>Bill To:</h3>
<p>John Doe<br>
456 Client Avenue<br>
Los Angeles, CA 90001</p>
</div>
<table class='invoice-table'>
<thead>
<tr>
<th>Description</th>
<th>Quantity</th>
<th>Unit Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>Professional Services - Web Development</td>
<td>40 hours</td>
<td>$150.00</td>
<td>$6,000.00</td>
</tr>
<tr>
<td>Hosting Services (Annual)</td>
<td>1</td>
<td>$1,200.00</td>
<td>$1,200.00</td>
</tr>
<tr>
<td>Domain Registration</td>
<td>2</td>
<td>$15.00</td>
<td>$30.00</td>
</tr>
</tbody>
</table>
<div class='total-section'>
<div class='total-row'>
<span class='label'>Subtotal:</span>
<span>$7,230.00</span>
</div>
<div class='total-row'>
<span class='label'>Tax (8%):</span>
<span>$578.40</span>
</div>
<div class='total-row grand-total'>
<span class='label'>Total Due:</span>
<span>$7,808.40</span>
</div>
</div>
<div class='footer' style='margin-top: 50px; padding-top: 20px; border-top: 1px solid #ddd; text-align: center; color: #666;'>
<p>Thank you for your business!<br>
Payment is due within 30 days. Please include invoice number with payment.</p>
</div>
</body>
</html>";
// Generate PDF with base path for local assets
var pdf = renderer.RenderHtmlAsPdf(invoiceHtml, @"C:\Assets\");
// Add security
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights;
pdf.SecuritySettings.OwnerPassword = "admin123";
// Save with optimization
pdf.CompressImages(60); // 60% quality for smaller file size
pdf.SaveAs("professional-invoice.pdf");
}
}
Imports IronPdf
Imports System.IO
Public Class HtmlStringToPdf
Public Shared Sub GenerateInvoicePdf()
Dim renderer = New ChromePdfRenderer()
' Configure for print-quality output
renderer.RenderingOptions = New ChromePdfRenderOptions With {
.PaperSize = PdfPaperSize.A4,
.DPI = 300,
.CssMediaType = PdfCssMediaType.Print,
.PaperFit = New PaperFit With {
.UseFitToPageRendering = True,
.RenderScale = 100
}
}
' Professional invoice HTML
Dim invoiceHtml As String = "
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<style>
@page {
size: A4;
margin: 0;
}
body {
font-family: 'Segoe UI', Arial, sans-serif;
margin: 0;
padding: 20mm;
color: #333;
}
.invoice-header {
display: flex;
justify-content: space-between;
align-items: start;
margin-bottom: 30px;
border-bottom: 2px solid #0066cc;
padding-bottom: 20px;
}
.company-info h1 {
color: #0066cc;
margin: 0;
font-size: 28px;
}
.invoice-details {
text-align: right;
}
.invoice-details h2 {
color: #666;
margin: 0 0 10px 0;
font-size: 24px;
}
.invoice-table {
width: 100%;
border-collapse: collapse;
margin-top: 30px;
}
.invoice-table th {
background-color: #0066cc;
color: white;
padding: 12px;
text-align: left;
}
.invoice-table td {
padding: 12px;
border-bottom: 1px solid #ddd;
}
.invoice-table tr:hover {
background-color: #f5f5f5;
}
.total-section {
margin-top: 30px;
text-align: right;
}
.total-section .total-row {
display: flex;
justify-content: flex-end;
margin: 5px 0;
}
.total-section .label {
font-weight: bold;
margin-right: 20px;
min-width: 100px;
}
.total-section .grand-total {
font-size: 20px;
color: #0066cc;
border-top: 2px solid #0066cc;
padding-top: 10px;
margin-top: 10px;
}
@media print {
.no-print { display: none; }
}
</style>
</head>
<body>
<div class='invoice-header'>
<div class='company-info'>
<h1>ACME Corporation</h1>
<p>123 Business Street<br>
New York, NY 10001<br>
Phone: (555) 123-4567<br>
Email: billing@acme.com</p>
</div>
<div class='invoice-details'>
<h2>INVOICE</h2>
<p><strong>Invoice #:</strong> INV-2025-001<br>
<strong>Date:</strong> " & DateTime.Now.ToString("MMMM dd, yyyy") & "<br>
<strong>Due Date:</strong> " & DateTime.Now.AddDays(30).ToString("MMMM dd, yyyy") & "</p>
</div>
</div>
<div class='billing-info'>
<h3>Bill To:</h3>
<p>John Doe<br>
456 Client Avenue<br>
Los Angeles, CA 90001</p>
</div>
<table class='invoice-table'>
<thead>
<tr>
<th>Description</th>
<th>Quantity</th>
<th>Unit Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>Professional Services - Web Development</td>
<td>40 hours</td>
<td>$150.00</td>
<td>$6,000.00</td>
</tr>
<tr>
<td>Hosting Services (Annual)</td>
<td>1</td>
<td>$1,200.00</td>
<td>$1,200.00</td>
</tr>
<tr>
<td>Domain Registration</td>
<td>2</td>
<td>$15.00</td>
<td>$30.00</td>
</tr>
</tbody>
</table>
<div class='total-section'>
<div class='total-row'>
<span class='label'>Subtotal:</span>
<span>$7,230.00</span>
</div>
<div class='total-row'>
<span class='label'>Tax (8%):</span>
<span>$578.40</span>
</div>
<div class='total-row grand-total'>
<span class='label'>Total Due:</span>
<span>$7,808.40</span>
</div>
</div>
<div class='footer' style='margin-top: 50px; padding-top: 20px; border-top: 1px solid #ddd; text-align: center; color: #666;'>
<p>Thank you for your business!<br>
Payment is due within 30 days. Please include invoice number with payment.</p>
</div>
</body>
</html>"
' Generate PDF with base path for local assets
Dim pdf = renderer.RenderHtmlAsPdf(invoiceHtml, "C:\Assets\")
' Add security
pdf.SecuritySettings.AllowUserEditing = False
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights
pdf.SecuritySettings.OwnerPassword = "admin123"
' Save with optimization
pdf.CompressImages(60) ' 60% quality for smaller file size
pdf.SaveAs("professional-invoice.pdf")
End Sub
End Class
この例が示すもの:
-プロフェッショナルレイアウト:フレックスボックスとグリッドを使用した複雑なCSS -動的コンテンツ:日付の計算と書式設定 -印刷最適化:印刷固有のスタイル設定のためのメディアクエリ -セキュリティ機能:パスワード保護と権限設定 -ファイルの最適化:ファイルサイズを小さくするための画像圧縮
ABCpdfを使用する
ABCpdfのスタイル付きテキストを使用したHTML文字列の処理:
using WebSupergoo.ABCpdf13;
public class ABCpdfHtmlString
{
public static void CreateStyledDocument()
{
using (Doc theDoc = new Doc())
{
// Set up the document
theDoc.Rect.Inset(40, 40);
theDoc.Color.String = "0 0 0"; // Black text
// Add styled HTML content
theDoc.FontSize = 48;
string styledHtml = @"
<h1 style='color: #0066cc'>ABCpdf Document</h1>
<p style='font-size: 14pt; line-height: 1.5'>
This demonstrates <b>bold text</b>, <i>italic text</i>,
and <span style='color: red'>colored text</span>.
</p>
<ul style='margin-left: 20px'>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>";
// Add HTML with automatic text flow
int theID = theDoc.AddImageHtml(styledHtml);
// Continue on new pages if needed
while (true)
{
if (!theDoc.Chainable(theID))
break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
// Apply compression
theDoc.Encryption.Type = 2; // 128-bit encryption
theDoc.Encryption.CanPrint = true;
theDoc.Encryption.CanModify = false;
theDoc.Save("styled-abcpdf.pdf");
}
}
}
using WebSupergoo.ABCpdf13;
public class ABCpdfHtmlString
{
public static void CreateStyledDocument()
{
using (Doc theDoc = new Doc())
{
// Set up the document
theDoc.Rect.Inset(40, 40);
theDoc.Color.String = "0 0 0"; // Black text
// Add styled HTML content
theDoc.FontSize = 48;
string styledHtml = @"
<h1 style='color: #0066cc'>ABCpdf Document</h1>
<p style='font-size: 14pt; line-height: 1.5'>
This demonstrates <b>bold text</b>, <i>italic text</i>,
and <span style='color: red'>colored text</span>.
</p>
<ul style='margin-left: 20px'>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>";
// Add HTML with automatic text flow
int theID = theDoc.AddImageHtml(styledHtml);
// Continue on new pages if needed
while (true)
{
if (!theDoc.Chainable(theID))
break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
// Apply compression
theDoc.Encryption.Type = 2; // 128-bit encryption
theDoc.Encryption.CanPrint = true;
theDoc.Encryption.CanModify = false;
theDoc.Save("styled-abcpdf.pdf");
}
}
}
Imports WebSupergoo.ABCpdf13
Public Class ABCpdfHtmlString
Public Shared Sub CreateStyledDocument()
Using theDoc As New Doc()
' Set up the document
theDoc.Rect.Inset(40, 40)
theDoc.Color.String = "0 0 0" ' Black text
' Add styled HTML content
theDoc.FontSize = 48
Dim styledHtml As String = "
<h1 style='color: #0066cc'>ABCpdf Document</h1>
<p style='font-size: 14pt; line-height: 1.5'>
This demonstrates <b>bold text</b>, <i>italic text</i>,
and <span style='color: red'>colored text</span>.
</p>
<ul style='margin-left: 20px'>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>"
' Add HTML with automatic text flow
Dim theID As Integer = theDoc.AddImageHtml(styledHtml)
' Continue on new pages if needed
Do
If Not theDoc.Chainable(theID) Then
Exit Do
End If
theDoc.Page = theDoc.AddPage()
theID = theDoc.AddImageToChain(theID)
Loop
' Apply compression
theDoc.Encryption.Type = 2 ' 128-bit encryption
theDoc.Encryption.CanPrint = True
theDoc.Encryption.CanModify = False
theDoc.Save("styled-abcpdf.pdf")
End Using
End Sub
End Class
パフォーマンスベンチマーク
パフォーマンス特性を理解することで、特定のユースケースに適したライブラリを選択するのに役立ちます。
ベンチマークテスト設定
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using IronPdf;
using WebSupergoo.ABCpdf13;
[MemoryDiagnoser]
[SimpleJob(warmupCount: 3, targetCount: 10)]
public class PdfGenerationBenchmark
{
private string _simpleHtml;
private string _complexHtml;
private ChromePdfRenderer _ironPdfRenderer;
private Doc _abcPdfDoc;
[GlobalSetup]
public void Setup()
{
_simpleHtml = "<h1>Simple Document</h1><p>Basic paragraph text.</p>";
_complexHtml = File.ReadAllText("complex-page.html"); // 50KB HTML with CSS/JS
_ironPdfRenderer = new ChromePdfRenderer();
_abcPdfDoc = new Doc();
_abcPdfDoc.HtmlOptions.Engine = EngineType.Chrome;
}
[Benchmark]
public void IronPDF_SimpleHtml()
{
var pdf = _ironPdfRenderer.RenderHtmlAsPdf(_simpleHtml);
pdf.SaveAs("temp_iron_simple.pdf");
}
[Benchmark]
public void ABCpdf_SimpleHtml()
{
_abcPdfDoc.Clear();
_abcPdfDoc.AddImageHtml(_simpleHtml);
_abcPdfDoc.Save("temp_abc_simple.pdf");
}
[Benchmark]
public void IronPDF_ComplexHtml()
{
var pdf = _ironPdfRenderer.RenderHtmlAsPdf(_complexHtml);
pdf.SaveAs("temp_iron_complex.pdf");
}
[Benchmark]
public void ABCpdf_ComplexHtml()
{
_abcPdfDoc.Clear();
int id = _abcPdfDoc.AddImageHtml(_complexHtml);
while (_abcPdfDoc.Chainable(id))
{
_abcPdfDoc.Page = _abcPdfDoc.AddPage();
id = _abcPdfDoc.AddImageToChain(id);
}
_abcPdfDoc.Save("temp_abc_complex.pdf");
}
}
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using IronPdf;
using WebSupergoo.ABCpdf13;
[MemoryDiagnoser]
[SimpleJob(warmupCount: 3, targetCount: 10)]
public class PdfGenerationBenchmark
{
private string _simpleHtml;
private string _complexHtml;
private ChromePdfRenderer _ironPdfRenderer;
private Doc _abcPdfDoc;
[GlobalSetup]
public void Setup()
{
_simpleHtml = "<h1>Simple Document</h1><p>Basic paragraph text.</p>";
_complexHtml = File.ReadAllText("complex-page.html"); // 50KB HTML with CSS/JS
_ironPdfRenderer = new ChromePdfRenderer();
_abcPdfDoc = new Doc();
_abcPdfDoc.HtmlOptions.Engine = EngineType.Chrome;
}
[Benchmark]
public void IronPDF_SimpleHtml()
{
var pdf = _ironPdfRenderer.RenderHtmlAsPdf(_simpleHtml);
pdf.SaveAs("temp_iron_simple.pdf");
}
[Benchmark]
public void ABCpdf_SimpleHtml()
{
_abcPdfDoc.Clear();
_abcPdfDoc.AddImageHtml(_simpleHtml);
_abcPdfDoc.Save("temp_abc_simple.pdf");
}
[Benchmark]
public void IronPDF_ComplexHtml()
{
var pdf = _ironPdfRenderer.RenderHtmlAsPdf(_complexHtml);
pdf.SaveAs("temp_iron_complex.pdf");
}
[Benchmark]
public void ABCpdf_ComplexHtml()
{
_abcPdfDoc.Clear();
int id = _abcPdfDoc.AddImageHtml(_complexHtml);
while (_abcPdfDoc.Chainable(id))
{
_abcPdfDoc.Page = _abcPdfDoc.AddPage();
id = _abcPdfDoc.AddImageToChain(id);
}
_abcPdfDoc.Save("temp_abc_complex.pdf");
}
}
Imports BenchmarkDotNet.Attributes
Imports BenchmarkDotNet.Running
Imports IronPdf
Imports WebSupergoo.ABCpdf13
<MemoryDiagnoser>
<SimpleJob(warmupCount:= 3, targetCount:= 10)>
Public Class PdfGenerationBenchmark
Private _simpleHtml As String
Private _complexHtml As String
Private _ironPdfRenderer As ChromePdfRenderer
Private _abcPdfDoc As Doc
<GlobalSetup>
Public Sub Setup()
_simpleHtml = "<h1>Simple Document</h1><p>Basic paragraph text.</p>"
_complexHtml = File.ReadAllText("complex-page.html") ' 50KB HTML with CSS/JS
_ironPdfRenderer = New ChromePdfRenderer()
_abcPdfDoc = New Doc()
_abcPdfDoc.HtmlOptions.Engine = EngineType.Chrome
End Sub
<Benchmark>
Public Sub IronPDF_SimpleHtml()
Dim pdf = _ironPdfRenderer.RenderHtmlAsPdf(_simpleHtml)
pdf.SaveAs("temp_iron_simple.pdf")
End Sub
<Benchmark>
Public Sub ABCpdf_SimpleHtml()
_abcPdfDoc.Clear()
_abcPdfDoc.AddImageHtml(_simpleHtml)
_abcPdfDoc.Save("temp_abc_simple.pdf")
End Sub
<Benchmark>
Public Sub IronPDF_ComplexHtml()
Dim pdf = _ironPdfRenderer.RenderHtmlAsPdf(_complexHtml)
pdf.SaveAs("temp_iron_complex.pdf")
End Sub
<Benchmark>
Public Sub ABCpdf_ComplexHtml()
_abcPdfDoc.Clear()
Dim id As Integer = _abcPdfDoc.AddImageHtml(_complexHtml)
Do While _abcPdfDoc.Chainable(id)
_abcPdfDoc.Page = _abcPdfDoc.AddPage()
id = _abcPdfDoc.AddImageToChain(id)
Loop
_abcPdfDoc.Save("temp_abc_complex.pdf")
End Sub
End Class
典型的な結果
| 方法 | 平均 | エラー | 標準偏差 | メモリ |
|---|---|---|---|---|
| IronPDF_SimpleHtml | 245.3 ms | 4.2 ms | 3.8 ms | 152 MB |
| ABCpdf_SimpleHtml | 187.6 ms | 3.1 ms | 2.9 ms | 98 MB |
| IronPDF_ComplexHtml | 892.4 ms | 12.3 ms | 10.8 ms | 201 MB |
| ABCpdf_ComplexHtml | 743.2 ms | 9.7 ms | 8.6 ms | 145 MB |
主な観察点:
- ABCpdfは生の変換速度が速いことを示します
- IronPDFは完全Chromeエンジンのためにさらにメモリを使用します
- 両ライブラリとも、ドキュメントの複雑さに応じて線形にスケールします
- IronPDFのオーバーヘッドがより良いレンダリング精度を提供します
高度な機能比較
デジタル署名とセキュリティ
IronPDFのデジタル署名実装
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;
public class SecurityFeatures
{
public static void ApplyDigitalSignature()
{
// Load existing PDF
var pdf = PdfDocument.FromFile("unsigned-document.pdf");
// Load certificate
var cert = new X509Certificate2("certificate.pfx", "password");
// Create signature
var signature = new PdfSignature(cert)
{
// Visual signature appearance
SignatureImage = new PdfSignature.SignatureImage
{
ImagePath = "signature.png",
Width = 200,
Height = 100
},
// Signature position
PageIndex = 0,
X = 400,
Y = 100,
// Signature details
Reason = "Document approved",
Location = "New York, NY",
ContactInfo = "john.doe@company.com"
};
// Apply signature
pdf.Sign(signature);
// Additional security
pdf.SecuritySettings = new SecuritySettings
{
AllowUserPrinting = true,
AllowUserCopyPasteContent = false,
AllowUserEditing = false,
AllowUserFormData = true,
OwnerPassword = "owner123",
UserPassword = "user123",
EncryptionLevel = EncryptionLevel.AES256
};
pdf.SaveAs("signed-secured.pdf");
}
}
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;
public class SecurityFeatures
{
public static void ApplyDigitalSignature()
{
// Load existing PDF
var pdf = PdfDocument.FromFile("unsigned-document.pdf");
// Load certificate
var cert = new X509Certificate2("certificate.pfx", "password");
// Create signature
var signature = new PdfSignature(cert)
{
// Visual signature appearance
SignatureImage = new PdfSignature.SignatureImage
{
ImagePath = "signature.png",
Width = 200,
Height = 100
},
// Signature position
PageIndex = 0,
X = 400,
Y = 100,
// Signature details
Reason = "Document approved",
Location = "New York, NY",
ContactInfo = "john.doe@company.com"
};
// Apply signature
pdf.Sign(signature);
// Additional security
pdf.SecuritySettings = new SecuritySettings
{
AllowUserPrinting = true,
AllowUserCopyPasteContent = false,
AllowUserEditing = false,
AllowUserFormData = true,
OwnerPassword = "owner123",
UserPassword = "user123",
EncryptionLevel = EncryptionLevel.AES256
};
pdf.SaveAs("signed-secured.pdf");
}
}
Imports IronPdf
Imports IronPdf.Signing
Imports System.Security.Cryptography.X509Certificates
Public Class SecurityFeatures
Public Shared Sub ApplyDigitalSignature()
' Load existing PDF
Dim pdf = PdfDocument.FromFile("unsigned-document.pdf")
' Load certificate
Dim cert = New X509Certificate2("certificate.pfx", "password")
' Create signature
Dim signature = New PdfSignature(cert) With {
.SignatureImage = New PdfSignature.SignatureImage With {
.ImagePath = "signature.png",
.Width = 200,
.Height = 100
},
.PageIndex = 0,
.X = 400,
.Y = 100,
.Reason = "Document approved",
.Location = "New York, NY",
.ContactInfo = "john.doe@company.com"
}
' Apply signature
pdf.Sign(signature)
' Additional security
pdf.SecuritySettings = New SecuritySettings With {
.AllowUserPrinting = True,
.AllowUserCopyPasteContent = False,
.AllowUserEditing = False,
.AllowUserFormData = True,
.OwnerPassword = "owner123",
.UserPassword = "user123",
.EncryptionLevel = EncryptionLevel.AES256
}
pdf.SaveAs("signed-secured.pdf")
End Sub
End Class
ABCpdfのデジタル署名実装
using WebSupergoo.ABCpdf13;
using WebSupergoo.ABCpdf13.Objects;
public class ABCpdfSecurity
{
public static void SignDocument()
{
using (Doc theDoc = new Doc())
{
theDoc.Read("unsigned-document.pdf");
// Create signature field
Field signatureField = theDoc.Form.AddFieldSignature("AuthorSignature");
signatureField.Page = 1;
signatureField.Rect = "400 100 600 200";
// Configure signature
Signature theSig = signatureField.Sign();
theSig.Reason = "Document approved";
theSig.Location = "New York, NY";
theSig.ContactInfo = "john.doe@company.com";
// Load certificate
theSig.LoadCertificate("certificate.pfx", "password");
// Apply visual signature
theSig.Visible = true;
theSig.Image = theDoc.AddImageFile("signature.png");
// Sign and save
theDoc.Save("abcpdf-signed.pdf");
}
}
}
using WebSupergoo.ABCpdf13;
using WebSupergoo.ABCpdf13.Objects;
public class ABCpdfSecurity
{
public static void SignDocument()
{
using (Doc theDoc = new Doc())
{
theDoc.Read("unsigned-document.pdf");
// Create signature field
Field signatureField = theDoc.Form.AddFieldSignature("AuthorSignature");
signatureField.Page = 1;
signatureField.Rect = "400 100 600 200";
// Configure signature
Signature theSig = signatureField.Sign();
theSig.Reason = "Document approved";
theSig.Location = "New York, NY";
theSig.ContactInfo = "john.doe@company.com";
// Load certificate
theSig.LoadCertificate("certificate.pfx", "password");
// Apply visual signature
theSig.Visible = true;
theSig.Image = theDoc.AddImageFile("signature.png");
// Sign and save
theDoc.Save("abcpdf-signed.pdf");
}
}
}
Imports WebSupergoo.ABCpdf13
Imports WebSupergoo.ABCpdf13.Objects
Public Class ABCpdfSecurity
Public Shared Sub SignDocument()
Using theDoc As New Doc()
theDoc.Read("unsigned-document.pdf")
' Create signature field
Dim signatureField As Field = theDoc.Form.AddFieldSignature("AuthorSignature")
signatureField.Page = 1
signatureField.Rect = "400 100 600 200"
' Configure signature
Dim theSig As Signature = signatureField.Sign()
theSig.Reason = "Document approved"
theSig.Location = "New York, NY"
theSig.ContactInfo = "john.doe@company.com"
' Load certificate
theSig.LoadCertificate("certificate.pfx", "password")
' Apply visual signature
theSig.Visible = True
theSig.Image = theDoc.AddImageFile("signature.png")
' Sign and save
theDoc.Save("abcpdf-signed.pdf")
End Using
End Sub
End Class
フォームの取り扱いとデータ抽出
IronPDFのフォーム管理
public class FormHandling
{
public static void WorkWithForms()
{
// Create PDF with form fields from HTML
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
string formHtml = @"
<form>
<label>Name: <input type='text' name='fullname' required></label><br>
<label>Email: <input type='email' name='email' required></label><br>
<label>Subscribe: <input type='checkbox' name='subscribe' value='yes'></label><br>
<label>Country:
<select name='country'>
<option>USA</option>
<option>Canada</option>
<option>UK</option>
</select>
</label><br>
<button type='submit'>Submit</button>
</form>";
var pdf = renderer.RenderHtmlAsPdf(formHtml);
// Fill form programmatically
pdf.Form.Fields["fullname"].Value = "John Doe";
pdf.Form.Fields["email"].Value = "john@example.com";
pdf.Form.Fields["subscribe"].Value = "yes";
pdf.Form.Fields["country"].Value = "USA";
// Extract form data
foreach (var field in pdf.Form.Fields)
{
Console.WriteLine($"{field.Name}: {field.Value}");
}
// Flatten form (make non-editable)
pdf.Form.Flatten();
pdf.SaveAs("filled-form.pdf");
}
}
public class FormHandling
{
public static void WorkWithForms()
{
// Create PDF with form fields from HTML
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
string formHtml = @"
<form>
<label>Name: <input type='text' name='fullname' required></label><br>
<label>Email: <input type='email' name='email' required></label><br>
<label>Subscribe: <input type='checkbox' name='subscribe' value='yes'></label><br>
<label>Country:
<select name='country'>
<option>USA</option>
<option>Canada</option>
<option>UK</option>
</select>
</label><br>
<button type='submit'>Submit</button>
</form>";
var pdf = renderer.RenderHtmlAsPdf(formHtml);
// Fill form programmatically
pdf.Form.Fields["fullname"].Value = "John Doe";
pdf.Form.Fields["email"].Value = "john@example.com";
pdf.Form.Fields["subscribe"].Value = "yes";
pdf.Form.Fields["country"].Value = "USA";
// Extract form data
foreach (var field in pdf.Form.Fields)
{
Console.WriteLine($"{field.Name}: {field.Value}");
}
// Flatten form (make non-editable)
pdf.Form.Flatten();
pdf.SaveAs("filled-form.pdf");
}
}
Public Class FormHandling
Public Shared Sub WorkWithForms()
' Create PDF with form fields from HTML
Dim renderer = New ChromePdfRenderer()
renderer.RenderingOptions.CreatePdfFormsFromHtml = True
Dim formHtml As String = "
<form>
<label>Name: <input type='text' name='fullname' required></label><br>
<label>Email: <input type='email' name='email' required></label><br>
<label>Subscribe: <input type='checkbox' name='subscribe' value='yes'></label><br>
<label>Country:
<select name='country'>
<option>USA</option>
<option>Canada</option>
<option>UK</option>
</select>
</label><br>
<button type='submit'>Submit</button>
</form>"
Dim pdf = renderer.RenderHtmlAsPdf(formHtml)
' Fill form programmatically
pdf.Form.Fields("fullname").Value = "John Doe"
pdf.Form.Fields("email").Value = "john@example.com"
pdf.Form.Fields("subscribe").Value = "yes"
pdf.Form.Fields("country").Value = "USA"
' Extract form data
For Each field In pdf.Form.Fields
Console.WriteLine($"{field.Name}: {field.Value}")
Next field
' Flatten form (make non-editable)
pdf.Form.Flatten()
pdf.SaveAs("filled-form.pdf")
End Sub
End Class
バッチ処理と最適化
IronPDFのバッチ処理
using System.Threading.Tasks;
using System.Collections.Concurrent;
public class BatchProcessing
{
public static async Task ProcessMultipleDocumentsAsync(List<string> htmlFiles)
{
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
// Use concurrent processing
var pdfResults = new ConcurrentBag<(string filename, byte[] data)>();
await Parallel.ForEachAsync(htmlFiles, async (htmlFile, ct) =>
{
try
{
var html = await File.ReadAllTextAsync(htmlFile);
var pdf = await renderer.RenderHtmlAsPdfAsync(html);
// Optimize each PDF
pdf.CompressImages(70);
var filename = Path.GetFileNameWithoutExtension(htmlFile) + ".pdf";
var data = pdf.BinaryData;
pdfResults.Add((filename, data));
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {htmlFile}: {ex.Message}");
}
});
// Merge all PDFs into one
var finalPdf = new PdfDocument();
foreach (var (filename, data) in pdfResults.OrderBy(x => x.filename))
{
var pdf = new PdfDocument(data);
finalPdf.AppendPdf(pdf);
}
finalPdf.SaveAs("batch-processed.pdf");
}
}
using System.Threading.Tasks;
using System.Collections.Concurrent;
public class BatchProcessing
{
public static async Task ProcessMultipleDocumentsAsync(List<string> htmlFiles)
{
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
// Use concurrent processing
var pdfResults = new ConcurrentBag<(string filename, byte[] data)>();
await Parallel.ForEachAsync(htmlFiles, async (htmlFile, ct) =>
{
try
{
var html = await File.ReadAllTextAsync(htmlFile);
var pdf = await renderer.RenderHtmlAsPdfAsync(html);
// Optimize each PDF
pdf.CompressImages(70);
var filename = Path.GetFileNameWithoutExtension(htmlFile) + ".pdf";
var data = pdf.BinaryData;
pdfResults.Add((filename, data));
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {htmlFile}: {ex.Message}");
}
});
// Merge all PDFs into one
var finalPdf = new PdfDocument();
foreach (var (filename, data) in pdfResults.OrderBy(x => x.filename))
{
var pdf = new PdfDocument(data);
finalPdf.AppendPdf(pdf);
}
finalPdf.SaveAs("batch-processed.pdf");
}
}
Imports System.Threading.Tasks
Imports System.Collections.Concurrent
Public Class BatchProcessing
Public Shared Async Function ProcessMultipleDocumentsAsync(ByVal htmlFiles As List(Of String)) As Task
Dim renderer = New ChromePdfRenderer()
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4
' Use concurrent processing
Dim pdfResults = New ConcurrentBag(Of (filename As String, data As Byte()))()
Await Parallel.ForEachAsync(htmlFiles, Async Sub(htmlFile, ct)
Try
Dim html = Await File.ReadAllTextAsync(htmlFile)
Dim pdf = Await renderer.RenderHtmlAsPdfAsync(html)
' Optimize each PDF
pdf.CompressImages(70)
Dim filename = Path.GetFileNameWithoutExtension(htmlFile) & ".pdf"
Dim data = pdf.BinaryData
pdfResults.Add((filename, data))
Catch ex As Exception
Console.WriteLine($"Error processing {htmlFile}: {ex.Message}")
End Try
End Sub)
' Merge all PDFs into one
Dim finalPdf = New PdfDocument()
foreach var(filename, data) In pdfResults.OrderBy(Function(x) x.filename)
Dim pdf = New PdfDocument(data)
finalPdf.AppendPdf(pdf)
Next
finalPdf.SaveAs("batch-processed.pdf")
End Function
End Class
実際の使用例シナリオ
どのライブラリがプロジェクトに適しているか?
IronPDFを選ぶとき:
-
クラウドネイティブアプリケーションを構築する場合
- 最小限の構成でのネイティブDockerサポート
- Azure FunctionsおよびAWS Lambda互換性
- すべてのクラウドプラットフォームでの一貫した動作
-
ピクセルパーフェクトなHTMLレンダリングが必要な場合
- 複雑なCSSレイアウト (グリッド、フレックスボックス)
- JavaScript重視のシングルページアプリケーション
- ウェブフォントの要件
-
クロスプラットフォームソリューションを開発する場合
- Windows、Linux、macOSをターゲットにしたアプリケーション
- マイクロサービスアーキテクチャ
- コンテナベースのデプロイメント
- 開発者体験を優先する場合
- 迅速なプロトタイピングのニーズ
- 小さな開発チーム
- 限られたPDFの専門知識
ABCpdfを選ぶとき:
-
レガシーシステムで作業する場合
- Windowsのみの環境
- 既存のABCpdf実装
- IE互換のコンテンツ要件
-
特定のレンダリングエンジンが必要な場合
- 異なるブラウザ間のテスト
- エンジン固有の最適化
- レガシー・ブラウザのサポート
-
高度なPDF操作
- 低レベルのPDFオブジェクトアクセス
- カスタムPDFオペレーター
- 複雑なドキュメントマージシナリオ
- 予算に敏感なプロジェクト
- 低いエントリープライスポイント
- 単一開発者ライセンス
- 32ビット環境の互換性
一般的な問題のトラブルシューティング
IronPDFの一般的な問題と解決策
public class IronPdfTroubleshooting
{
// Issue: Fonts not rendering correctly
public static void FixFontIssues()
{
var renderer = new ChromePdfRenderer();
// Solution 1: Wait for fonts to load
renderer.RenderingOptions.WaitFor.RenderDelay(1000);
// Solution 2: Use system fonts fallback
renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print;
}
// Issue: JavaScript not executing
public static void FixJavaScriptIssues()
{
var renderer = new ChromePdfRenderer();
// Enable JavaScript and wait for execution
renderer.RenderingOptions.EnableJavaScript = true;
renderer.RenderingOptions.WaitFor.JavaScriptFinishDelay = 2000;
renderer.RenderingOptions.WaitFor.AllowedExecutionTime = 30000;
}
// Issue: メモリ usage in Docker
public static void OptimizeForDocker()
{
var renderer = new ChromePdfRenderer();
// Use single-threaded mode for containers
IronPdf.Installation.SingleThreaded = true;
// Reduce memory footprint
renderer.RenderingOptions.ViewPortWidth = 1024;
renderer.RenderingOptions.EnableGrayscale = true;
}
}
public class IronPdfTroubleshooting
{
// Issue: Fonts not rendering correctly
public static void FixFontIssues()
{
var renderer = new ChromePdfRenderer();
// Solution 1: Wait for fonts to load
renderer.RenderingOptions.WaitFor.RenderDelay(1000);
// Solution 2: Use system fonts fallback
renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print;
}
// Issue: JavaScript not executing
public static void FixJavaScriptIssues()
{
var renderer = new ChromePdfRenderer();
// Enable JavaScript and wait for execution
renderer.RenderingOptions.EnableJavaScript = true;
renderer.RenderingOptions.WaitFor.JavaScriptFinishDelay = 2000;
renderer.RenderingOptions.WaitFor.AllowedExecutionTime = 30000;
}
// Issue: メモリ usage in Docker
public static void OptimizeForDocker()
{
var renderer = new ChromePdfRenderer();
// Use single-threaded mode for containers
IronPdf.Installation.SingleThreaded = true;
// Reduce memory footprint
renderer.RenderingOptions.ViewPortWidth = 1024;
renderer.RenderingOptions.EnableGrayscale = true;
}
}
Imports IronPdf
Public Class IronPdfTroubleshooting
' Issue: Fonts not rendering correctly
Public Shared Sub FixFontIssues()
Dim renderer = New ChromePdfRenderer()
' Solution 1: Wait for fonts to load
renderer.RenderingOptions.WaitFor.RenderDelay(1000)
' Solution 2: Use system fonts fallback
renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print
End Sub
' Issue: JavaScript not executing
Public Shared Sub FixJavaScriptIssues()
Dim renderer = New ChromePdfRenderer()
' Enable JavaScript and wait for execution
renderer.RenderingOptions.EnableJavaScript = True
renderer.RenderingOptions.WaitFor.JavaScriptFinishDelay = 2000
renderer.RenderingOptions.WaitFor.AllowedExecutionTime = 30000
End Sub
' Issue: メモリ usage in Docker
Public Shared Sub OptimizeForDocker()
Dim renderer = New ChromePdfRenderer()
' Use single-threaded mode for containers
IronPdf.Installation.SingleThreaded = True
' Reduce memory footprint
renderer.RenderingOptions.ViewPortWidth = 1024
renderer.RenderingOptions.EnableGrayscale = True
End Sub
End Class
ABCpdfの一般的な問題と解決策
public class ABCpdfTroubleshooting
{
// Issue: Page breaks in wrong places
public static void FixPageBreaks()
{
using (Doc theDoc = new Doc())
{
// Use HTML page break controls
theDoc.HtmlOptions.BreakZoneSize = 100; // pixels
theDoc.HtmlOptions.UseScript = true;
string html = @"
<style>
.page-break { page-break-after: always; }
.no-break { page-break-inside: avoid; }
</style>
<div class='no-break'>Keep this content together</div>
<div class='page-break'></div>
<div>New page content</div>";
theDoc.AddImageHtml(html);
theDoc.Save("fixed-breaks.pdf");
}
}
// Issue: Images not loading
public static void FixImageLoading()
{
using (Doc theDoc = new Doc())
{
// Set timeout and authentication
theDoc.HtmlOptions.Timeout = 60000; // 60 seconds
theDoc.HtmlOptions.RetryCount = 3;
// For local images, set base directory
theDoc.HtmlOptions.BaseUrl = @"file:///C:/Images/";
theDoc.AddImageHtml("<img src='logo.png'>");
theDoc.Save("with-images.pdf");
}
}
}
public class ABCpdfTroubleshooting
{
// Issue: Page breaks in wrong places
public static void FixPageBreaks()
{
using (Doc theDoc = new Doc())
{
// Use HTML page break controls
theDoc.HtmlOptions.BreakZoneSize = 100; // pixels
theDoc.HtmlOptions.UseScript = true;
string html = @"
<style>
.page-break { page-break-after: always; }
.no-break { page-break-inside: avoid; }
</style>
<div class='no-break'>Keep this content together</div>
<div class='page-break'></div>
<div>New page content</div>";
theDoc.AddImageHtml(html);
theDoc.Save("fixed-breaks.pdf");
}
}
// Issue: Images not loading
public static void FixImageLoading()
{
using (Doc theDoc = new Doc())
{
// Set timeout and authentication
theDoc.HtmlOptions.Timeout = 60000; // 60 seconds
theDoc.HtmlOptions.RetryCount = 3;
// For local images, set base directory
theDoc.HtmlOptions.BaseUrl = @"file:///C:/Images/";
theDoc.AddImageHtml("<img src='logo.png'>");
theDoc.Save("with-images.pdf");
}
}
}
Public Class ABCpdfTroubleshooting
' Issue: Page breaks in wrong places
Public Shared Sub FixPageBreaks()
Using theDoc As New Doc()
' Use HTML page break controls
theDoc.HtmlOptions.BreakZoneSize = 100 ' pixels
theDoc.HtmlOptions.UseScript = True
Dim html As String = "
<style>
.page-break { page-break-after: always; }
.no-break { page-break-inside: avoid; }
</style>
<div class='no-break'>Keep this content together</div>
<div class='page-break'></div>
<div>New page content</div>"
theDoc.AddImageHtml(html)
theDoc.Save("fixed-breaks.pdf")
End Using
End Sub
' Issue: Images not loading
Public Shared Sub FixImageLoading()
Using theDoc As New Doc()
' Set timeout and authentication
theDoc.HtmlOptions.Timeout = 60000 ' 60 seconds
theDoc.HtmlOptions.RetryCount = 3
' For local images, set base directory
theDoc.HtmlOptions.BaseUrl = "file:///C:/Images/"
theDoc.AddImageHtml("<img src='logo.png'>")
theDoc.Save("with-images.pdf")
End Using
End Sub
End Class
ライブラリ間の移行ガイド
ABCpdfからIronPDFへの移行
public class MigrationHelper
{
// ABCpdf code
public void OldABCpdfMethod()
{
Doc theDoc = new Doc();
theDoc.AddImageUrl("https://example.com");
theDoc.Save("output.pdf");
theDoc.Dispose();
}
// Equivalent IronPDF code
public void NewIronPdfMethod()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://example.com");
pdf.SaveAs("output.pdf");
}
// Migration wrapper for gradual transition
public class PdfWrapper
{
private bool _useIronPdf;
public PdfWrapper(bool useIronPdf = true)
{
_useIronPdf = useIronPdf;
}
public void ConvertUrlToPdf(string url, string outputPath)
{
if (_useIronPdf)
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf(url);
pdf.SaveAs(outputPath);
}
else
{
using (var doc = new Doc())
{
doc.AddImageUrl(url);
doc.Save(outputPath);
}
}
}
}
}
public class MigrationHelper
{
// ABCpdf code
public void OldABCpdfMethod()
{
Doc theDoc = new Doc();
theDoc.AddImageUrl("https://example.com");
theDoc.Save("output.pdf");
theDoc.Dispose();
}
// Equivalent IronPDF code
public void NewIronPdfMethod()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://example.com");
pdf.SaveAs("output.pdf");
}
// Migration wrapper for gradual transition
public class PdfWrapper
{
private bool _useIronPdf;
public PdfWrapper(bool useIronPdf = true)
{
_useIronPdf = useIronPdf;
}
public void ConvertUrlToPdf(string url, string outputPath)
{
if (_useIronPdf)
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf(url);
pdf.SaveAs(outputPath);
}
else
{
using (var doc = new Doc())
{
doc.AddImageUrl(url);
doc.Save(outputPath);
}
}
}
}
}
Public Class MigrationHelper
' ABCpdf code
Public Sub OldABCpdfMethod()
Dim theDoc As New Doc()
theDoc.AddImageUrl("https://example.com")
theDoc.Save("output.pdf")
theDoc.Dispose()
End Sub
' Equivalent IronPDF code
Public Sub NewIronPdfMethod()
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://example.com")
pdf.SaveAs("output.pdf")
End Sub
' Migration wrapper for gradual transition
Public Class PdfWrapper
Private _useIronPdf As Boolean
Public Sub New(Optional ByVal useIronPdf As Boolean = True)
_useIronPdf = useIronPdf
End Sub
Public Sub ConvertUrlToPdf(ByVal url As String, ByVal outputPath As String)
If _useIronPdf Then
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf(url)
pdf.SaveAs(outputPath)
Else
Using doc As New Doc()
doc.AddImageUrl(url)
doc.Save(outputPath)
End Using
End If
End Sub
End Class
End Class
ライセンスと総所有コスト
プロジェクトのROI計算
PDFライブラリを評価する際は、ライセンス価格を超えた総コストを考慮してください:
IronPDFのコスト分析
-開発時間の節約:実装が50~70%高速化 -サポート費用: 24時間365日のエンジニアリングサポートが含まれます -メンテナンス:プラットフォーム間で統合された API -スケーラビリティ: 1つのライセンスで複数の展開をカバー
ABCpdfのコスト分析
-初期費用:低い参入価格 -隠れたコスト:
- 別の64ビットライセンス
- 複数のエンジン要件
- プラットフォーム固有のテスト
- 追加のサポートコスト
ライセンス比較計算機
public class LicenseCostCalculator
{
public static void CalculateTotalCost()
{
// Scenario: 5-developer team, 3-year project
// IronPDF Professional
var ironPdfCost = new
{
License = 2999, // 10 developers, 10 projects
Support = 0, // Included
Training = 500, // Minimal due to simple API
ThreeYearTotal = 3499
};
// ABCpdf equivalent setup
var abcPdfCost = new
{
StandardLicenses = 329 * 5, // 5 developers
ProfessionalUpgrade = 150 * 5, // 64-bit support
再配布License = 4790, // Enterprise
Support = 399 * 3, // Annual support
Training = 2000, // Complex API training
ThreeYearTotal = 1645 + 750 + 4790 + 1197 + 2000
};
Console.WriteLine($"IronPDF 3-year TCO: ${ironPdfCost.ThreeYearTotal:N0}");
Console.WriteLine($"ABCpdf 3-year TCO: ${abcPdfCost.ThreeYearTotal:N0}");
Console.WriteLine($"Savings with IronPDF: ${abcPdfCost.ThreeYearTotal - ironPdfCost.ThreeYearTotal:N0}");
}
}
public class LicenseCostCalculator
{
public static void CalculateTotalCost()
{
// Scenario: 5-developer team, 3-year project
// IronPDF Professional
var ironPdfCost = new
{
License = 2999, // 10 developers, 10 projects
Support = 0, // Included
Training = 500, // Minimal due to simple API
ThreeYearTotal = 3499
};
// ABCpdf equivalent setup
var abcPdfCost = new
{
StandardLicenses = 329 * 5, // 5 developers
ProfessionalUpgrade = 150 * 5, // 64-bit support
再配布License = 4790, // Enterprise
Support = 399 * 3, // Annual support
Training = 2000, // Complex API training
ThreeYearTotal = 1645 + 750 + 4790 + 1197 + 2000
};
Console.WriteLine($"IronPDF 3-year TCO: ${ironPdfCost.ThreeYearTotal:N0}");
Console.WriteLine($"ABCpdf 3-year TCO: ${abcPdfCost.ThreeYearTotal:N0}");
Console.WriteLine($"Savings with IronPDF: ${abcPdfCost.ThreeYearTotal - ironPdfCost.ThreeYearTotal:N0}");
}
}
Public Class LicenseCostCalculator
Public Shared Sub CalculateTotalCost()
' Scenario: 5-developer team, 3-year project
' IronPDF Professional
Dim ironPdfCost = New With {
.License = 2999, ' 10 developers, 10 projects
.Support = 0, ' Included
.Training = 500, ' Minimal due to simple API
.ThreeYearTotal = 3499
}
' ABCpdf equivalent setup
Dim abcPdfCost = New With {
.StandardLicenses = 329 * 5, ' 5 developers
.ProfessionalUpgrade = 150 * 5, ' 64-bit support
.再配布License = 4790, ' Enterprise
.Support = 399 * 3, ' Annual support
.Training = 2000, ' Complex API training
.ThreeYearTotal = 1645 + 750 + 4790 + 1197 + 2000
}
Console.WriteLine($"IronPDF 3-year TCO: ${ironPdfCost.ThreeYearTotal:N0}")
Console.WriteLine($"ABCpdf 3-year TCO: ${abcPdfCost.ThreeYearTotal:N0}")
Console.WriteLine($"Savings with IronPDF: ${abcPdfCost.ThreeYearTotal - ironPdfCost.ThreeYearTotal:N0}")
End Sub
End Class
結論
両方のライブラリを徹底的に分析した結果、いくつかの重要な違いが浮かび上がりました。
IronPDFは以下で優れています:
- Chromeベースのレンダリングを用いたモダンなウェブ技術のサポート
- クロスプラットフォームの一貫性とクラウドネイティブデプロイメント
- 直感的なAPIによる開発者の生産性
- 包括的なサポートとドキュメンテーション
- 拡張し続けるチームに対するより良い長期的価値
ABCpdfが提供する利点:
- Windowsのみの基本プロジェクトに対する低い初期コスト
- 複数のレンダリングエンジンオプション
- レガシーシステムの互換性
- 単純なドキュメントのための低メモリフットプリント
IronPDFはすべてのPDF問題への単一の解決策を提供します。 IronPDFを購入すると、単一のライブラリでのすべての変換が得られ、PDFドキュメントにのみ関連するタスクが追加の依存関係を必要としません。 この統合されたアプローチは、優れたレンダリング品質とクロスプラットフォームサポートを組み合わせることで、ほとんどのモダンな.NETアプリケーションにおける推奨される選択肢です。
迅速な開発、一貫したプラットフォーム間での結果、そして長期的なメンテナンス性を優先するチームにとって、IronPDFの高い初期コストは、開発時間の短縮、より良いサポート、互換性の問題が少ないことで相殺されます。
IronPDFを始めよう
違いを体験する準備はできましたか? 無料トライアルを始める今日:
// Get started in minutes
// Install-Package IronPdf
// Your first PDF in 3 lines
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
pdf.SaveAs("my-first-pdf.pdf");
// Get started in minutes
// Install-Package IronPdf
// Your first PDF in 3 lines
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
pdf.SaveAs("my-first-pdf.pdf");
' Get started in minutes
' Install-Package IronPdf
' Your first PDF in 3 lines
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>")
pdf.SaveAs("my-first-pdf.pdf")
私たちの包括的なドキュメンテーションを訪れ、コード例を探索し、またはPDF生成のニーズについて個別のガイダンスを得るために私たちのエンジニアリングチームとチャットしてください。
よくある質問
レンダリングエンジンの観点から、IronPDF と ABCpdf の主な違いは何ですか?
IronPDF は Chrome ベースのレンダリングエンジンを使用しており、ピクセルパーフェクトな出力を提供し、CSS3 と JavaScript を完全にサポートしているため、最新のウェブ技術のレンダリングに理想的です。対して、ABCpdf は Chrome、Firefox、または IE のような複数のレンダリングエンジンを提供し、柔軟性を持たせていますが、より多くのテストと設定が必要です。
IronPDF の HTML から PDF への変換品質は、ABCpdf と比較してどうですか?
IronPDF は、Chrome ベースのエンジンによりレンダリング精度に優れ、最新のブラウザの出力と一致します。ABCpdf はやや高速ですが、複雑な最新のウェブコンテンツにおいて同じレベルの精度を提供しないことがあるかもしれません。
IronPDF と ABCpdf の互換性の違いは何ですか?
IronPDF は Windows、Linux、macOS、および Docker コンテナで動作するネイティブクロスプラットフォームサポートを提供します。ABCpdf は主に Windows 環境を対象としており、多様な開発セットアップにおける使用が制限されるかもしれません。
長期的に .NET アプリケーション向けにより良い価値を提供するのは、IronPDF か ABCpdf か?
ABCpdf は初期価格が低いですが、IronPDF は包括的なサポート、最新のアーキテクチャ、および統一された API を提供し、特に継続的なメンテナンスと更新が必要な現代の .NET アプリケーションにとって長期的な価値があります。
企業向け使用における IronPDF のライセンスモデルと ABCpdf の比較はどのようなものですか?
IronPDF のライセンスは $749 から始まりますが、ABCpdf は $329 という低い初期価格を提供します。しかし、総所有コストの計算では、拡張サポートと更新によって IronPDF が企業利用においてコスト効率の高い選択であることが示されています。
ABCpdf から IronPDF への移行戦略にはどのようなものがありますか?
ABCpdf から IronPDF への移行には、IronPDF の包括的な API ドキュメントとサポートリソースを活用できます。開発者は、現在の機能を IronPDF のメソッドにマッピングし、出力を徹底的にテストして一貫した結果を保証するべきです。
IronPDF は JavaScript を伴う動的 HTML コンテンツを処理できますか?
はい、IronPDF はレンダリング前に JavaScript を実行でき、動的コンテンツ、AJAX コール、および最新のフレームワークをサポートします。動的要素の完全な処理を保証するために、待機時間やレンダリング遅延を設定できます。
IronPDF 使用時のレンダリング問題のトラブルシューティングに推奨されるアプローチは何ですか?
IronPDF のレンダリング問題を解決するには、まず Chrome エンジンが CSS 機能をサポートしていることを確認します。PDF 特有のスタイルにはプリントメディアクエリを使用し、ブラウザ開発ツールで CSS を検証し、問題を特定するために簡単化された HTML でテストします。



