SpirePDF C# HTML to PDF チュートリアル&ライブラリ比較
HTML を PDF に変換することは、多くの .NET アプリケーションにとって重要な要件です。請求書やレポートの生成から、ドキュメントおよび電子書籍の作成に至るまでです。 HTML から PDF への変換ニーズに対して IronPDF と Spire.PDF を選択する際には、それぞれの強み、制限、実際のパフォーマンスを理解することが重要です。 この包括的な比較は、両方のライブラリの機能を検証し、PDF 生成の要件に対して情報に基づいた意思決定を行うのに役立ちます。
HTML から PDF への変換における IronPDF と Spire.PDF の主な違いは何ですか?
IronPDF は、PDF ファイルの変換、PDF の編集、PDF の作成、PDF ファイルの読み取りなど、幅広い PDF 関連タスクを処理できるように設計された汎用的な .NET PDF ライブラリです。 既存の .NET アプリケーションへの統合の容易さ、高性能、HTML5、CSS3、JavaScript などの最新の Web 標準のサポートで知られています。 IronPDF の Chrome ベースのレンダリング エンジンにより、HTML コンテンツからのピクセル パーフェクトな PDF 生成が保証されます。
Spire.PDF for .NET は、PDF の作成と操作のための包括的な機能セットを提供する強力な .NET PDF ライブラリです。 テキストおよび画像の抽出、PDF フォームの入力、デジタル署名など、さまざまな PDF 機能をサポートします。 機能は包括的ですが、HTML から PDF への変換機能には、開発者が考慮すべき特定の制限があります。
| カテゴリ | 特徴/側面 | IronPDF | Spire.PDF | 主な利点 |
|---|---|---|---|---|
| **コア**アーキテクチャ | デザイン哲学 | シンプルさ第一、直感的なAPI | マルチクラスアプローチ、手動セットアップ | IronPDF: より速い開発 |
| APIの複雑さ | `RenderHtmlAsPdf()`のような単純なメソッド。 | マルチスレッドアプローチが必要 | IronPDF: コードが70%削減 | |
| 学習曲線 | 通常1~2日 | 通常1~2週間 | IronPDF: より迅速な導入 | |
| **プラットフォームサポート** | クロスプラットフォーム | ネイティブサポート、追加パッケージなし | Linux/macOSを限定的にサポート | IronPDF:真のクロスプラットフォーム |
| .NETバージョン | .NET 8、7、6、5、Core 3.1+、Framework 4.6.2+。 | .NET Core 2.0+、Framework 2.0+に対応していること。 | 両方:幅広いフレームワークのサポート | |
| オペレーティングシステム | Windows、Linux、macOS、Dockerネイティブ | 主にWindowsにフォーカス | IronPDF:より幅広いOSをサポート | |
| **HTMLからPDFへ** | レンダリングエンジン | フルChromeV8エンジン | カスタムHTMLパーサー | IronPDF: 98%以上のブラウザ忠実度 |
| CSS3/HTML5 サポート | 完全なサポート | 制限あり(基本的なCSSのみ) | IronPDF: 最新のWeb標準 | |
| JavaScriptの実行 | 完全なJavaScriptサポート | 計画中、未実施 | IronPDF: 動的コンテンツ対応 | |
| Webフォント | Googleフォント、システムフォント | 限られたフォントサポート | IronPDF:組版の柔軟性 | |
| レンダリング速度 | 0.8-1.2sの典型例 | 0.簡単なHTMLで5~0.8秒 | Spire:基本的なHTMLをより速く | |
| **Security & Encryption** | 暗号化レベル | AES-256、カスタムハンドラー | AES-256標準 | 両方:業界標準 |
| APIの簡素化 | 単一の `SecuritySettings` クラス | 複数のセキュリティ方式 | IronPDF:統一されたアプローチ | |
| **コンテンツ操作** | 再編集方法 | 真のコンテンツ削除、1行API | 手動矩形オーバーレイ | IronPDF:コンプライアンス対応 |
| 透かし入り | HTML/CSSベースの完全なスタイル | テキストベース、ローテーションあり | IronPDF: 豊富な透かし | |
| **ファイル変換**。 | DOCXからPDF | 組み込みの`DocxToPdfRenderer`です。 | Spire.Docライブラリが必要です。 | IronPDF:追加費用なし |
| **パフォーマンス指標** | メモリ使用量 | 150-200MB(Chromeエンジン) | 80-120MB | Spire:低いメモリフットプリント |
| スレッドサポート | ネイティブのasync/awaitを最適化 | STAスレッド必須 | IronPDF:最新の非同期パターン | |
| **開発者としての経験** | コード例 | すぐに実行できる100以上のサンプル | 基本的な例 | IronPDF:豊富なリソース |
| エラーメッセージ | 説明的で実用的 | 技術的メッセージ | IronPDF:より良いデバッグ | |
| **Licensing & Pricing** | エントリーレベル | Lite: $999 (1 dev, 1 project) | Developer: $1,499/year (1 dev) | IronPDF:永久ライセンス |
| Team License | Plus: $1,499 (3 devs, 3 projects) | サイト:4,599ドル(開発者10名) | IronPDF:チームの価値を高める | |
| スイートオプション | Iron Suite: $1,498 (9 products) | スイートオプションなし | IronPDF:卓越した価値 | |
| **サポート** | サポートが含まれています | はい、24時間365日のエンジニアリングサポート | フォーラムのみ(有料サポートは別途) | IronPDF: サポートが含まれています |
| サポートチャネル | 電子メール、チャット、電話、画面共有 | フォーラム、電子メール(有料) | IronPDF:その他のチャンネル | |
| **最適**な対象 | 使用例 | 最新のウェブアプリ、複雑なHTML/CSS | シンプルな文書、基本的なレイアウト | 文脈依存 |
IronPDF の詳細情報は IronPDF.com を訪問してください。
クロスプラットフォームの互換性はライブラリ間でどのように比較されますか?
IronPDF
IronPDF は、広範なクロスプラットフォーム互換性で際立っている。 .NET Framework内の幅広い環境をサポートし、異なるプラットフォーム間でのシームレスな動作を保証します。 以下に IronPDF のプラットフォーム互換性の概要を示します。
-
.NET バージョン:
- 完全に C#、VB.NET、F# で書かれており、サポートしています。
- .NET Core (8, 7, 6, 5, および 3.1+)
- .NET Standard (2.0+)
- .NET Framework (4.6.2+)
- アプリ環境: IronPDF は Windows、Linux、Mac、Docker、Azure、AWS などの様々なアプリ環境で動作します。
- IDEs: Microsoft Visual Studio および JetBrains Rider & ReSharper などの IDE で動作します。
- OS とプロセッサ: Windows、Mac、Linux、x64、x86、ARM などの様々な OS & プロセッサをサポートします。
IronPDF の互換性の詳細については、IronPDF フィーチャーページを訪問してください。
Spire.PDF
Spire.PDF は .NET 環境内でフルサポートを提供しますが、Windows オペレーティング システム内で動作する一方で、IronPDF が持つ Linux および macOS に対するネイティブ サポートが欠けています。 macOS または Linux でのデプロイ時には、Spire.PDF は各プラットフォーム用の異なるプラグインを必要とし、デプロイメント シナリオを複雑にする可能性があります。
-
.NET サポート:
- .NET Framework 2.0+
- .NET Core 2.0+
- C# で記述され、VB.NET をサポートしています。
- アプリ環境: Spire.PDF は Windows および ASP.NET アプリケーションなどの様々なアプリ環境で動作します。 Windows フォームもサポートできます。
どちらのライブラリがより優れた HTML の PDF 変換機能を提供しますか?
IronPDFの機能
- PDF 変換: IronPDF は、HTML を PDF に変換できます。 最新の Web 標準の完全なサポートにより、IronPDF は HTML コンテンツから常にピクセル パーフェクトな PDF を返すことが保証されています。 IronPDF は、他の形式からの PDF ファイルの変換も可能で、例えば DOCX、画像、RTF などがあります。
- PDF 生成: IronPDF では、URL、ASPX ファイル、HTML 文字列から PDF を生成することができます。
- セキュリティ機能: IronPDF を使用すると、セキュリティ機能のおかげで、他の敏感な PDF ファイルも常に安全であることを保証できます。 IronPDFを使用してPDFファイルを暗号化し、パスワードを設定し、PDFファイルの権限を設定します。
- PDF編集機能: IronPDFを使えば、既存のPDFドキュメントを処理し、編集し、PDFファイルを簡単に読むことができます。 IronPDFは、PDFにテキストや画像を追加したり、PDFを分割または結合する編集機能を提供します。
- 統合: ASP.NET および MVC アプリケーションとシームレスに統合できます。
- PDF バージョン サポート: PDF バージョン 1.2-1.7 をサポートできます。
IronPDF の包括的な機能一覧については、IronPDF の機能を訪問してください。
Spire.PDF の機能
- PDF 作成: ゼロからまたは既存のファイルから PDF を作成します。
- テキストおよび画像抽出:Spire.PDFを使用してPDFページとコンテンツを抽出します。
- PDFフォーム処理: PDFフォームの入力と管理。
- PDF変換: PDFをHTML、RTF、画像などの他のフォーマットに変換します。
- ページ操作: PDF内のページを挿入、削除、並べ替えます。
- 限定的な HTML サポート: HTML から PDF へのエンジンでは、最新の CSS と JavaScript のサポートが限定されています。 デフォルトの Qt ベースのプラグインは、CSS のページ区切りプロパティや外部 CSS ファイルの認識をサポートせず、JavaScript の実行は、まだ完全に実装されていない計画された機能です。 より良いレンダリングのためにオプションの ChromeHtmlConverter が利用可能です。
Bootstrap と最新の CSS フレームワークのレンダリング
最新の Web 開発は、迅速な UI 開発とレスポンシブデザインのために、Bootstrap のような CSS フレームワークに大きく依存しています。 PDF 生成ライブラリは、これらのフレームワークを正確に変換して、プロフェッショナルなドキュメント品質およびデザインの一貫性を維持する必要があります。
IronPDF: 完全な Bootstrap および Tailwind のサポート
IronPDFのChromiumエンジンは、すべての最新CSSフレームワークを完全にサポートします:
- Bootstrap 5:すべてのレスポンシブコンポーネントで完全なフレックスボックスとCSSグリッドをサポート
- Bootstrap 4:完全なカードレイアウト、ナビゲーションシステム、ユーティリティクラス
- Tailwind CSS:すべてのユーティリティファーストクラスとレスポンシブ修飾子 -基盤:完全なグリッドとコンポーネントシステム -モダン CSS3: Flexbox、グリッド、カスタムプロパティ、アニメーション、トランスフォーム
実証済みの具体的な例: Bootstrap ホームページ および Bootstrap テンプレート はピクセル単位の精度で変換されます。
コード例: Team Member カード with Bootstrap
using IronPdf;
var renderer = new ChromePdfRenderer();
string bootstrapTeam = @"
<!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='text-center mb-5'>Our Team</h1>
<div class='row row-cols-1 row-cols-md-3 g-4'>
<div class='col'>
<div class='card h-100 shadow-sm text-center'>
<div class='card-body d-flex flex-column'>
<img src='https://via.placeholder.com/150' class='rounded-circle mx-auto mb-3' alt='Team member' style='width: 150px; height: 150px; object-fit: cover;'>
<h5 class='card-title'>Jennifer Martinez</h5>
<p class='text-muted mb-3'>Chief Technology Officer</p>
<p class='card-text flex-grow-1'>Leading our technical vision and innovation strategy with over 15 years of experience in software architecture.</p>
<div class='d-flex justify-content-center gap-2 mt-auto'>
<a href='#' class='btn btn-sm btn-outline-primary'>LinkedIn</a>
<a href='#' class='btn btn-sm btn-outline-secondary'>Email</a>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100 shadow-sm text-center'>
<div class='card-body d-flex flex-column'>
<img src='https://via.placeholder.com/150' class='rounded-circle mx-auto mb-3' alt='Team member' style='width: 150px; height: 150px; object-fit: cover;'>
<h5 class='card-title'>David Chen</h5>
<p class='text-muted mb-3'>Head of Engineering</p>
<p class='card-text flex-grow-1'>Managing our engineering teams and ensuring product quality through rigorous testing and code review processes.</p>
<div class='d-flex justify-content-center gap-2 mt-auto'>
<a href='#' class='btn btn-sm btn-outline-primary'>LinkedIn</a>
<a href='#' class='btn btn-sm btn-outline-secondary'>Email</a>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100 shadow-sm text-center'>
<div class='card-body d-flex flex-column'>
<img src='https://via.placeholder.com/150' class='rounded-circle mx-auto mb-3' alt='Team member' style='width: 150px; height: 150px; object-fit: cover;'>
<h5 class='card-title'>Sarah Johnson</h5>
<p class='text-muted mb-3'>Product Manager</p>
<p class='card-text flex-grow-1'>Driving product strategy and customer satisfaction through data-driven decisions and user research.</p>
<div class='d-flex justify-content-center gap-2 mt-auto'>
<a href='#' class='btn btn-sm btn-outline-primary'>LinkedIn</a>
<a href='#' class='btn btn-sm btn-outline-secondary'>Email</a>
</div>
</div>
</div>
</div>
</div>
<div class='text-center mt-5'>
<h3>Join Our Team</h3>
<p class='text-muted mb-3'>We're always looking for talented individuals to join our growing team.</p>
<a href='#' class='btn btn-primary btn-lg'>View Open Positions</a>
</div>
</div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(bootstrapTeam);
pdf.SaveAs("team-members.pdf");
using IronPdf;
var renderer = new ChromePdfRenderer();
string bootstrapTeam = @"
<!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='text-center mb-5'>Our Team</h1>
<div class='row row-cols-1 row-cols-md-3 g-4'>
<div class='col'>
<div class='card h-100 shadow-sm text-center'>
<div class='card-body d-flex flex-column'>
<img src='https://via.placeholder.com/150' class='rounded-circle mx-auto mb-3' alt='Team member' style='width: 150px; height: 150px; object-fit: cover;'>
<h5 class='card-title'>Jennifer Martinez</h5>
<p class='text-muted mb-3'>Chief Technology Officer</p>
<p class='card-text flex-grow-1'>Leading our technical vision and innovation strategy with over 15 years of experience in software architecture.</p>
<div class='d-flex justify-content-center gap-2 mt-auto'>
<a href='#' class='btn btn-sm btn-outline-primary'>LinkedIn</a>
<a href='#' class='btn btn-sm btn-outline-secondary'>Email</a>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100 shadow-sm text-center'>
<div class='card-body d-flex flex-column'>
<img src='https://via.placeholder.com/150' class='rounded-circle mx-auto mb-3' alt='Team member' style='width: 150px; height: 150px; object-fit: cover;'>
<h5 class='card-title'>David Chen</h5>
<p class='text-muted mb-3'>Head of Engineering</p>
<p class='card-text flex-grow-1'>Managing our engineering teams and ensuring product quality through rigorous testing and code review processes.</p>
<div class='d-flex justify-content-center gap-2 mt-auto'>
<a href='#' class='btn btn-sm btn-outline-primary'>LinkedIn</a>
<a href='#' class='btn btn-sm btn-outline-secondary'>Email</a>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100 shadow-sm text-center'>
<div class='card-body d-flex flex-column'>
<img src='https://via.placeholder.com/150' class='rounded-circle mx-auto mb-3' alt='Team member' style='width: 150px; height: 150px; object-fit: cover;'>
<h5 class='card-title'>Sarah Johnson</h5>
<p class='text-muted mb-3'>Product Manager</p>
<p class='card-text flex-grow-1'>Driving product strategy and customer satisfaction through data-driven decisions and user research.</p>
<div class='d-flex justify-content-center gap-2 mt-auto'>
<a href='#' class='btn btn-sm btn-outline-primary'>LinkedIn</a>
<a href='#' class='btn btn-sm btn-outline-secondary'>Email</a>
</div>
</div>
</div>
</div>
</div>
<div class='text-center mt-5'>
<h3>Join Our Team</h3>
<p class='text-muted mb-3'>We're always looking for talented individuals to join our growing team.</p>
<a href='#' class='btn btn-primary btn-lg'>View Open Positions</a>
</div>
</div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(bootstrapTeam);
pdf.SaveAs("team-members.pdf");
Imports IronPdf
Dim renderer As New ChromePdfRenderer()
Dim bootstrapTeam 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='text-center mb-5'>Our Team</h1>
<div class='row row-cols-1 row-cols-md-3 g-4'>
<div class='col'>
<div class='card h-100 shadow-sm text-center'>
<div class='card-body d-flex flex-column'>
<img src='https://via.placeholder.com/150' class='rounded-circle mx-auto mb-3' alt='Team member' style='width: 150px; height: 150px; object-fit: cover;'>
<h5 class='card-title'>Jennifer Martinez</h5>
<p class='text-muted mb-3'>Chief Technology Officer</p>
<p class='card-text flex-grow-1'>Leading our technical vision and innovation strategy with over 15 years of experience in software architecture.</p>
<div class='d-flex justify-content-center gap-2 mt-auto'>
<a href='#' class='btn btn-sm btn-outline-primary'>LinkedIn</a>
<a href='#' class='btn btn-sm btn-outline-secondary'>Email</a>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100 shadow-sm text-center'>
<div class='card-body d-flex flex-column'>
<img src='https://via.placeholder.com/150' class='rounded-circle mx-auto mb-3' alt='Team member' style='width: 150px; height: 150px; object-fit: cover;'>
<h5 class='card-title'>David Chen</h5>
<p class='text-muted mb-3'>Head of Engineering</p>
<p class='card-text flex-grow-1'>Managing our engineering teams and ensuring product quality through rigorous testing and code review processes.</p>
<div class='d-flex justify-content-center gap-2 mt-auto'>
<a href='#' class='btn btn-sm btn-outline-primary'>LinkedIn</a>
<a href='#' class='btn btn-sm btn-outline-secondary'>Email</a>
</div>
</div>
</div>
</div>
<div class='col'>
<div class='card h-100 shadow-sm text-center'>
<div class='card-body d-flex flex-column'>
<img src='https://via.placeholder.com/150' class='rounded-circle mx-auto mb-3' alt='Team member' style='width: 150px; height: 150px; object-fit: cover;'>
<h5 class='card-title'>Sarah Johnson</h5>
<p class='text-muted mb-3'>Product Manager</p>
<p class='card-text flex-grow-1'>Driving product strategy and customer satisfaction through data-driven decisions and user research.</p>
<div class='d-flex justify-content-center gap-2 mt-auto'>
<a href='#' class='btn btn-sm btn-outline-primary'>LinkedIn</a>
<a href='#' class='btn btn-sm btn-outline-secondary'>Email</a>
</div>
</div>
</div>
</div>
</div>
<div class='text-center mt-5'>
<h3>Join Our Team</h3>
<p class='text-muted mb-3'>We're always looking for talented individuals to join our growing team.</p>
<a href='#' class='btn btn-primary btn-lg'>View Open Positions</a>
</div>
</div>
</body>
</html>"
Dim pdf = renderer.RenderHtmlAsPdf(bootstrapTeam)
pdf.SaveAs("team-members.pdf")
出力: Bootstrap のカード グリッド、フレックスボックスの配置、レスポンシブ イメージ、ボタン コンポーネントを備えたプロフェッショナルなチーム ページがすべて PDF で正確にレンダリングされます。
Spire.PDF: 限定的な HTML および最新のフレームワークサポート
Spire.PDF の HTML から PDF へのエンジンは、彼らの独自の文書に記載されているように、最新の CSS フレームワークに対する重大な制限があります。
-限定的な CSS サポート:基本的な CSS のみ、包括的な CSS3 機能はありません
- Flexboxなし: Bootstrap 4/5はFlexboxに大きく依存していますが、これはサポートされていません。
- CSS グリッドなし: CSS グリッドを使用する最新のレイアウトシステムでは正しくレンダリングされません。
- JavaScript の制限:最新のブラウザと比較してJavaScript の実行が最小限
- Bootstrap 3 Maximum:古いテーブルベースのBootstrapバージョンのみが確実に動作します -複雑なレイアウトは失敗します:現代のレスポンシブデザインには広範囲にわたる回避策が必要です
Spire.PDF HTML 変換に関する開発者レポートの問題:
- Bootstrap のナビゲーションバーが、レイアウトの問題でレンダリングされる
- Flexbox を持つカードコンポーネントが正しくアラインされない
- PDF 出力におけるレスポンシブのグリッドブレークポイントが無視される
- 現代の CSS 機能には手動での CSS 書き換えやフォールバックが必要
開発への影響: Bootstrap 4+ または最新の CSS フレームワークを使用するアプリケーションは、Spire.PDF で大きな課題に直面します。 開発チームは次を行う必要があります:
- PDF 生成用に特別設計された簡略化された CSS を維持する(ダブルメンテナンス)
- Bootstrap 3 にダウングレードするか、フレームワークを完全に放棄する(最新の機能に制限)
- 各コンポーネントをテストして手動で修正を行う(時間がかかり壊れやすい)
最新の CSS フレームワークのサポートを求めるプロジェクトにとって、Spire.PDF の HTML レンダリングの限界は、追加の開発努力と継続的な保守の負担なくしては不適切です。
詳細なBootstrapの互換性情報については、Bootstrap & Flexbox CSSガイドをご覧ください。
一般的な PDF タスクのためのコード例を比較するにはどうすればよいですか?
IronPDFとSpire.PDF for .NETの機能を示すために、いくつかの主要なPDF機能の実装をコード例を通じて比較し、これらの機能がPDFプロジェクトにどのように役立つかのアイデアを提供します。
HTMLをPDFに変換する
IronPDFの例:
using IronPdf;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from an HTML string using C#
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
pdf.SaveAs("output.pdf");
// Advanced Example with HTML Assets
// Load external HTML assets: images, CSS, and JavaScript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
using IronPdf;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from an HTML string using C#
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
pdf.SaveAs("output.pdf");
// Advanced Example with HTML Assets
// Load external HTML assets: images, CSS, and JavaScript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
Imports IronPdf
' Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = True
' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()
' Create a PDF from an HTML string using C#
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>")
pdf.SaveAs("output.pdf")
' Advanced Example with HTML Assets
' Load external HTML assets: images, CSS, and JavaScript.
' An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
Dim myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "C:\site\assets\")
myAdvancedPdf.SaveAs("html-with-assets.pdf")
IronPDFの ChromePdfRenderer クラスは、完全な Chrome ブラウザ エンジンを活用して HTML コンテンツをレンダリングします。 これにより、CSS3 アニメーション、JavaScript 実行、および最新の Web フォントが Chrome で同様に正確にレンダリングされます。 RenderHtmlAsPdf() メソッドは、外部アセットを読み込むための HTML 文字列とオプションの基本パスを受け入れるため、単純な HTML ドキュメントと複雑な HTML ドキュメントの両方を簡単に変換できます。 このレンダラーは、高度なレンダリングオプションをサポートしており、カスタムの用紙サイズ、マージン、JavaScript 遅延設定などを含みます。
Spire.PDF の例:
using Spire.Pdf;
using Spire.Pdf.HtmlConverter;
using System.IO;
using System.Threading;
using System.Drawing;
namespace ConvertHtmlStringToPdfWithoutPlugin
{
class Program
{
static void Main(string[] args)
{
// Create a PdfDocument object
PdfDocument doc = new PdfDocument();
// Create a PdfPageSettings object
PdfPageSettings setting = new PdfPageSettings();
// Set page size and margins through the object
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
// Create a PdfHtmlLayoutFormat object
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
// Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = true;
// Read HTML string from a .html file
string htmlString = File.ReadAllText(@"C:\Users\Administrator\Desktop\Document\Html\Sample.html");
// Load HTML from HTML string using LoadFromHTML method
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(htmlString, true, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
// Save to a PDF file
doc.SaveToFile("HtmlStringToPdf.pdf");
}
}
}
using Spire.Pdf;
using Spire.Pdf.HtmlConverter;
using System.IO;
using System.Threading;
using System.Drawing;
namespace ConvertHtmlStringToPdfWithoutPlugin
{
class Program
{
static void Main(string[] args)
{
// Create a PdfDocument object
PdfDocument doc = new PdfDocument();
// Create a PdfPageSettings object
PdfPageSettings setting = new PdfPageSettings();
// Set page size and margins through the object
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
// Create a PdfHtmlLayoutFormat object
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
// Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = true;
// Read HTML string from a .html file
string htmlString = File.ReadAllText(@"C:\Users\Administrator\Desktop\Document\Html\Sample.html");
// Load HTML from HTML string using LoadFromHTML method
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(htmlString, true, setting, htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
// Save to a PDF file
doc.SaveToFile("HtmlStringToPdf.pdf");
}
}
}
Imports Spire.Pdf
Imports Spire.Pdf.HtmlConverter
Imports System.IO
Imports System.Threading
Imports System.Drawing
Namespace ConvertHtmlStringToPdfWithoutPlugin
Friend Class Program
Shared Sub Main(ByVal args() As String)
' Create a PdfDocument object
Dim doc As New PdfDocument()
' Create a PdfPageSettings object
Dim setting As New PdfPageSettings()
' Set page size and margins through the object
setting.Size = New SizeF(1000, 1000)
setting.Margins = New Spire.Pdf.Graphics.PdfMargins(20)
' Create a PdfHtmlLayoutFormat object
Dim htmlLayoutFormat As New PdfHtmlLayoutFormat()
' Set IsWaiting property to true
htmlLayoutFormat.IsWaiting = True
' Read HTML string from a .html file
Dim htmlString As String = File.ReadAllText("C:\Users\Administrator\Desktop\Document\Html\Sample.html")
' Load HTML from HTML string using LoadFromHTML method
Dim thread As New Thread(Sub()
doc.LoadFromHTML(htmlString, True, setting, htmlLayoutFormat)
End Sub)
thread.SetApartmentState(ApartmentState.STA)
thread.Start()
thread.Join()
' Save to a PDF file
doc.SaveToFile("HtmlStringToPdf.pdf")
End Sub
End Class
End Namespace
Spire.PDF の HTML から PDF への変換では、PdfDocument、PdfPageSettings、PdfHtmlLayoutFormat を含む複数のオブジェクトを作成する必要があります。 この 変換はシングル スレッド アパートメント (STA) スレッドで実行する必要があり、実装が複雑になります。 ユーザーは、"Spire が生成する PDF ファイルはただの画像です。CSS の一部は正しくなく、太字フォントが無視される" など、CSS のレンダリングの忠実度に制限があることを報告しています。 一部のCSSは正しくなく、太字フォントを無視するなど、CSSレンダリングの忠実度に制限があることを示しています。
IronPDFは、高忠実度のHTMLからPDFへの変換のためにChromeのレンダリングエンジンを使用しており、最新のウェブ標準をサポートしているため、ウェブコンテンツの正確な表現を保証します。 ### PDF ドキュメントを暗号化するにはどうすればよいですか?
PDFドキュメントを暗号化するにはどうすればよいですか?
IronPDFの例:
using IronPdf;
using System;
// Open an Encrypted File, alternatively create a new PDF from HTML
var pdf = PdfDocument.FromFile("encrypted.pdf", "password");
// Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto";
pdf.MetaData.Keywords = "SEO, Friendly";
pdf.MetaData.ModifiedDate = DateTime.Now;
// Edit file security settings
pdf.SecuritySettings.RemovePasswordsAndEncryption();
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key");
pdf.SecuritySettings.AllowUserAnnotations = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserFormData = false;
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights;
// Change or set the document encryption password
pdf.Password = "my-password";
pdf.SaveAs("secured.pdf");
using IronPdf;
using System;
// Open an Encrypted File, alternatively create a new PDF from HTML
var pdf = PdfDocument.FromFile("encrypted.pdf", "password");
// Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto";
pdf.MetaData.Keywords = "SEO, Friendly";
pdf.MetaData.ModifiedDate = DateTime.Now;
// Edit file security settings
pdf.SecuritySettings.RemovePasswordsAndEncryption();
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key");
pdf.SecuritySettings.AllowUserAnnotations = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserFormData = false;
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights;
// Change or set the document encryption password
pdf.Password = "my-password";
pdf.SaveAs("secured.pdf");
Imports IronPdf
Imports System
' Open an Encrypted File, alternatively create a new PDF from HTML
Private pdf = PdfDocument.FromFile("encrypted.pdf", "password")
' Edit file metadata
pdf.MetaData.Author = "Satoshi Nakamoto"
pdf.MetaData.Keywords = "SEO, Friendly"
pdf.MetaData.ModifiedDate = DateTime.Now
' Edit file security settings
pdf.SecuritySettings.RemovePasswordsAndEncryption()
pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key")
pdf.SecuritySettings.AllowUserAnnotations = False
pdf.SecuritySettings.AllowUserCopyPasteContent = False
pdf.SecuritySettings.AllowUserFormData = False
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights
' Change or set the document encryption password
pdf.Password = "my-password"
pdf.SaveAs("secured.pdf")
IronPDF の SecuritySettings クラスは、PDF セキュリティを管理するための包括的な API を提供します。 この API は、個々の権限を制御するためのブールプロパティを使用し、異なる印刷権限を設定し、他のセキュリティ設定とは別にパスワードを管理できます。 API 設計は、PdfPrintSecurity のような厳密に型指定された列挙型を使用した.NET規則に従います。 Spire.PDF の暗号化方法は、ビット単位の権限フラグを使用した Security.Encrypt() メソッドを使用します。
Spire.PDF の例:
using Spire.Pdf;
using Spire.Pdf.Security;
// Create a PdfDocument object
PdfDocument pdf = new PdfDocument();
// Load a sample PDF file
pdf.LoadFromFile(@"E:\Files\sample.pdf");
// Encrypt the PDF file with a password
pdf.Security.Encrypt("open", "permission", PdfPermissionsFlags.Print | PdfPermissionsFlags.CopyContent, PdfEncryptionKeySize.Key128Bit);
// Save the result file
pdf.SaveToFile("Encrypt.pdf", FileFormat.PDF);
using Spire.Pdf;
using Spire.Pdf.Security;
// Create a PdfDocument object
PdfDocument pdf = new PdfDocument();
// Load a sample PDF file
pdf.LoadFromFile(@"E:\Files\sample.pdf");
// Encrypt the PDF file with a password
pdf.Security.Encrypt("open", "permission", PdfPermissionsFlags.Print | PdfPermissionsFlags.CopyContent, PdfEncryptionKeySize.Key128Bit);
// Save the result file
pdf.SaveToFile("Encrypt.pdf", FileFormat.PDF);
Imports Spire.Pdf
Imports Spire.Pdf.Security
' Create a PdfDocument object
Private pdf As New PdfDocument()
' Load a sample PDF file
pdf.LoadFromFile("E:\Files\sample.pdf")
' Encrypt the PDF file with a password
pdf.Security.Encrypt("open", "permission", PdfPermissionsFlags.Print Or PdfPermissionsFlags.CopyContent, PdfEncryptionKeySize.Key128Bit)
' Save the result file
pdf.SaveToFile("Encrypt.pdf", FileFormat.PDF)
Spire.PDF の暗号化アプローチでは、権限用のビット単位のフラグを使用した Security.Encrypt() メソッドが使用されます。 このアプローチはよりコンパクトですが、ビット単位の操作を理解する必要があり、IronPDF の個々の権限プロパティに比べて、より粗い制御を提供します。
IronPDF はセキュリティ設定の全面的なコントロールを提供しながら、簡単な方法を提供します。 IronPDFは簡単なアプローチを提供しつつ、PDFのセキュリティ設定を完全に制御できます。 Spire.PDFは若干短いプロセスですが、許可設定のための追加オプションを含んでいます。
PDFコンテンツを赤色表示するオプションは何ですか?
IronPDFの例:
using IronPdf;
// Load the PDF document
PdfDocument pdf = PdfDocument.FromFile("novel.pdf");
// Redact 'are' phrase from all pages
pdf.RedactTextOnAllPages("are");
// Save the redacted document
pdf.SaveAs("redacted.pdf");
using IronPdf;
// Load the PDF document
PdfDocument pdf = PdfDocument.FromFile("novel.pdf");
// Redact 'are' phrase from all pages
pdf.RedactTextOnAllPages("are");
// Save the redacted document
pdf.SaveAs("redacted.pdf");
Imports IronPdf
' Load the PDF document
Private pdf As PdfDocument = PdfDocument.FromFile("novel.pdf")
' Redact 'are' phrase from all pages
pdf.RedactTextOnAllPages("are")
' Save the redacted document
pdf.SaveAs("redacted.pdf")
RedactTextOnAllPages() メソッドは、指定されたテキストを検索して永久に削除し、データ保護規制を遵守します。 RedactTextOnAllPages() メソッドは、指定されたテキストを検索して永久に削除し、データ保護規制への準拠を保証します。 長方形のオーバーレイによる赤外表示のための IronPDF の例:
矩形オーバーレイによる赤色表示のためのSpire.PDF例:
この手動アプローチでは、各マスキング領域の正確な座標の計算が必要であり、真のコンテンツ削除よりも単なるビジュアルマスキングを提供します。元のテキストは、PDF 編集ツールを使用しても抽出可能である可能性があります。
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
// Specify the input PDF file path
string inputPdfFilePath = "path/to/your/input.pdf";
// Specify the output redacted PDF file path
string outputPdfFilePath = "path/to/your/redacted_output.pdf";
// Create a new PdfDocument object
PdfDocument pdfDocument = new PdfDocument();
// Load the existing PDF document
pdfDocument.LoadFromFile(inputPdfFilePath);
// Redact content on each page
foreach (PdfPageBase page in pdfDocument.Pages)
{
// Define the area to redact (e.g., coordinates and size of the rectangle)
RectangleF redactArea = new RectangleF(100, 100, 200, 50); // Example coordinates and size
// Apply redaction
page.Canvas.DrawRectangle(new PdfSolidBrush(Color.Black), redactArea);
}
// Save the redacted PDF document
pdfDocument.SaveToFile(outputPdfFilePath);
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
// Specify the input PDF file path
string inputPdfFilePath = "path/to/your/input.pdf";
// Specify the output redacted PDF file path
string outputPdfFilePath = "path/to/your/redacted_output.pdf";
// Create a new PdfDocument object
PdfDocument pdfDocument = new PdfDocument();
// Load the existing PDF document
pdfDocument.LoadFromFile(inputPdfFilePath);
// Redact content on each page
foreach (PdfPageBase page in pdfDocument.Pages)
{
// Define the area to redact (e.g., coordinates and size of the rectangle)
RectangleF redactArea = new RectangleF(100, 100, 200, 50); // Example coordinates and size
// Apply redaction
page.Canvas.DrawRectangle(new PdfSolidBrush(Color.Black), redactArea);
}
// Save the redacted PDF document
pdfDocument.SaveToFile(outputPdfFilePath);
Imports Spire.Pdf
Imports Spire.Pdf.Graphics
Imports System.Drawing
' Specify the input PDF file path
Private inputPdfFilePath As String = "path/to/your/input.pdf"
' Specify the output redacted PDF file path
Private outputPdfFilePath As String = "path/to/your/redacted_output.pdf"
' Create a new PdfDocument object
Private pdfDocument As New PdfDocument()
' Load the existing PDF document
pdfDocument.LoadFromFile(inputPdfFilePath)
' Redact content on each page
For Each page As PdfPageBase In pdfDocument.Pages
' Define the area to redact (e.g., coordinates and size of the rectangle)
Dim redactArea As New RectangleF(100, 100, 200, 50) ' Example coordinates and size
' Apply redaction
page.Canvas.DrawRectangle(New PdfSolidBrush(Color.Black), redactArea)
Next page
' Save the redacted PDF document
pdfDocument.SaveToFile(outputPdfFilePath)
この手動アプローチでは、各削除エリアの正確な座標を計算する必要があり、真のコンテンツの削除ではなく視覚的なマスキングのみを提供します。 ベースとなるテキストは、PDF編集ツールを通じてまだ抽出可能です。
IronPDF は、強力で簡単な削除ツールを提供し、削除を簡素化します。 Spire.PDFは組み込みの削除ツールがないために、削除の手動処理がより多く必要であり、効率の悪いワークフローをもたらす可能性があります。
各ラベルを手動で設定し、署名を正確に配置し、視覚的要素を個別に構成する必要があります。
IronPDFの例:
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;
// Instantiate the renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>foo</h1>");
// Create X509Certificate2 object with X509KeyStorageFlags set to Exportable
X509Certificate2 cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);
// Create PdfSignature with certificate
var sig = new PdfSignature(cert);
// Sign PDF document
pdf.Sign(sig);
pdf.SaveAs("signed.pdf");
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;
// Instantiate the renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>foo</h1>");
// Create X509Certificate2 object with X509KeyStorageFlags set to Exportable
X509Certificate2 cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);
// Create PdfSignature with certificate
var sig = new PdfSignature(cert);
// Sign PDF document
pdf.Sign(sig);
pdf.SaveAs("signed.pdf");
Imports IronPdf
Imports IronPdf.Signing
Imports System.Security.Cryptography.X509Certificates
' Instantiate the renderer
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>foo</h1>")
' Create X509Certificate2 object with X509KeyStorageFlags set to Exportable
Private cert As New X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable)
' Create PdfSignature with certificate
Private sig = New PdfSignature(cert)
' Sign PDF document
pdf.Sign(sig)
pdf.SaveAs("signed.pdf")
IronPDF's デジタル署名の実装は、.NET証明書処理パターンに従います。 PdfSignature クラスは標準の X509Certificate2 オブジェクトを受け入れ、PDF 署名の複雑な部分を内部で処理します。 視覚的な署名の表示を追加し、署名フィールドを構成することもできます。
Spire.PDF の例:
using Spire.Pdf;
using Spire.Pdf.Security;
using System.Drawing;
// Create a PdfDocument object
PdfDocument doc = new PdfDocument();
// Load a sample PDF file
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf");
// Load the certificate
PdfCertificate cert = new PdfCertificate("C:\\Users\\Administrator\\Desktop\\MyCertificate.pfx", "e-iceblue");
// Create a PdfSignature object and specify its position and size
PdfSignature signature = new PdfSignature(doc, doc.Pages[doc.Pages.Count - 1], cert, "MySignature");
RectangleF rectangleF = new RectangleF(doc.Pages[0].ActualSize.Width - 260 - 54 , 200, 260, 110);
signature.Bounds = rectangleF;
signature.Certificated = true;
// Set the graphics mode to ImageAndSignDetail
signature.GraphicsMode = GraphicMode.SignImageAndSignDetail;
// Set various details about the signature
signature.NameLabel = "Signer:";
signature.Name = "Gary";
signature.ContactInfoLabel = "Phone:";
signature.ContactInfo = "0123456";
signature.DateLabel = "Date:";
signature.Date = DateTime.Now;
signature.LocationInfoLabel = "Location:";
signature.LocationInfo = "USA";
signature.ReasonLabel = "Reason:";
signature.Reason = "I am the author";
signature.DistinguishedNameLabel = "DN:";
signature.DistinguishedName = signature.Certificate.IssuerName.Name;
// Set the signature image source
signature.SignImageSource = PdfImage.FromFile("C:\\Users\\Administrator\\Desktop\\handwrittingSignature.png");
// Set the signature font
signature.SignDetailsFont = new PdfTrueTypeFont(new Font("Arial Unicode MS", 12f, FontStyle.Regular));
// Set the document permission to forbid changes but allow form fill
signature.DocumentPermissions = PdfCertificationFlags.ForbidChanges | PdfCertificationFlags.AllowFormFill;
// Save to file
doc.SaveToFile("VisiableSignature.pdf");
using Spire.Pdf;
using Spire.Pdf.Security;
using System.Drawing;
// Create a PdfDocument object
PdfDocument doc = new PdfDocument();
// Load a sample PDF file
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf");
// Load the certificate
PdfCertificate cert = new PdfCertificate("C:\\Users\\Administrator\\Desktop\\MyCertificate.pfx", "e-iceblue");
// Create a PdfSignature object and specify its position and size
PdfSignature signature = new PdfSignature(doc, doc.Pages[doc.Pages.Count - 1], cert, "MySignature");
RectangleF rectangleF = new RectangleF(doc.Pages[0].ActualSize.Width - 260 - 54 , 200, 260, 110);
signature.Bounds = rectangleF;
signature.Certificated = true;
// Set the graphics mode to ImageAndSignDetail
signature.GraphicsMode = GraphicMode.SignImageAndSignDetail;
// Set various details about the signature
signature.NameLabel = "Signer:";
signature.Name = "Gary";
signature.ContactInfoLabel = "Phone:";
signature.ContactInfo = "0123456";
signature.DateLabel = "Date:";
signature.Date = DateTime.Now;
signature.LocationInfoLabel = "Location:";
signature.LocationInfo = "USA";
signature.ReasonLabel = "Reason:";
signature.Reason = "I am the author";
signature.DistinguishedNameLabel = "DN:";
signature.DistinguishedName = signature.Certificate.IssuerName.Name;
// Set the signature image source
signature.SignImageSource = PdfImage.FromFile("C:\\Users\\Administrator\\Desktop\\handwrittingSignature.png");
// Set the signature font
signature.SignDetailsFont = new PdfTrueTypeFont(new Font("Arial Unicode MS", 12f, FontStyle.Regular));
// Set the document permission to forbid changes but allow form fill
signature.DocumentPermissions = PdfCertificationFlags.ForbidChanges | PdfCertificationFlags.AllowFormFill;
// Save to file
doc.SaveToFile("VisiableSignature.pdf");
Imports Spire.Pdf
Imports Spire.Pdf.Security
Imports System.Drawing
' Create a PdfDocument object
Private doc As New PdfDocument()
' Load a sample PDF file
doc.LoadFromFile("C:\Users\Administrator\Desktop\sample.pdf")
' Load the certificate
Dim cert As New PdfCertificate("C:\Users\Administrator\Desktop\MyCertificate.pfx", "e-iceblue")
' Create a PdfSignature object and specify its position and size
Dim signature As New PdfSignature(doc, doc.Pages(doc.Pages.Count - 1), cert, "MySignature")
Dim rectangleF As New RectangleF(doc.Pages(0).ActualSize.Width - 260 - 54, 200, 260, 110)
signature.Bounds = rectangleF
signature.Certificated = True
' Set the graphics mode to ImageAndSignDetail
signature.GraphicsMode = GraphicMode.SignImageAndSignDetail
' Set various details about the signature
signature.NameLabel = "Signer:"
signature.Name = "Gary"
signature.ContactInfoLabel = "Phone:"
signature.ContactInfo = "0123456"
signature.DateLabel = "Date:"
signature.Date = DateTime.Now
signature.LocationInfoLabel = "Location:"
signature.LocationInfo = "USA"
signature.ReasonLabel = "Reason:"
signature.Reason = "I am the author"
signature.DistinguishedNameLabel = "DN:"
signature.DistinguishedName = signature.Certificate.IssuerName.Name
' Set the signature image source
signature.SignImageSource = PdfImage.FromFile("C:\Users\Administrator\Desktop\handwrittingSignature.png")
' Set the signature font
signature.SignDetailsFont = New PdfTrueTypeFont(New Font("Arial Unicode MS", 12F, FontStyle.Regular))
' Set the document permission to forbid changes but allow form fill
signature.DocumentPermissions = PdfCertificationFlags.ForbidChanges Or PdfCertificationFlags.AllowFormFill
' Save to file
doc.SaveToFile("VisiableSignature.pdf")
Spire.PDFは署名の外観を広範に制御できますが、かなり多くのコードが必要です。 IronPDF はデジタル署名を追加するための簡単なアプローチを提供し、署名プロセスの自動化を簡単にします。
PDFにデジタル署名を行うことは、PDFドキュメントの認証に使用されるなど、さまざまな設定で役立ちます。 IronPDFはデジタル署名を追加するための簡単なアプローチを提供し、署名プロセスの自動化を容易にします。 Spire.PDFもPDF用のデジタル署名をサポートしています; ただし、そのプロセスはより手動であり、実装するためにはより多くの努力が必要です。
PDFに透かしを入れるためのメソッドは何ですか?
IronPDFの例:
using IronPdf;
// Stamps a Watermark onto a new or existing PDF
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
pdf.SaveAs(@"C:\Path\To\Watermarked.pdf");
using IronPdf;
// Stamps a Watermark onto a new or existing PDF
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center);
pdf.SaveAs(@"C:\Path\To\Watermarked.pdf");
Imports IronPdf
' Stamps a Watermark onto a new or existing PDF
Private renderer = New ChromePdfRenderer()
Private pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")
pdf.ApplyWatermark("<h2 style='color:red'>SAMPLE</h2>", 30, IronPdf.Editing.VerticalAlignment.Middle, IronPdf.Editing.HorizontalAlignment.Center)
pdf.SaveAs("C:\Path\To\Watermarked.pdf")
IronPDF の透かし機能は HTML コンテンツを受け入れ、CSS を使用してスタイリングできます。 ApplyWatermark() メソッドは回転角度と位置合わせのパラメータを提供するため、透かしを正確に配置することが容易になります。 Learn more about カスタム透かしと高度なスタイリングオプションについて。
Spire.PDF の例:
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
// Create a PdfDocument object
PdfDocument pdf = new PdfDocument();
// Load a sample PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\sample.pdf");
// Create a PdfTrueTypeFont object
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", 50f), true);
// Set the watermark text
string text = "CONFIDENTIAL";
// Measure the text size
SizeF textSize = font.MeasureString(text);
// Calculate the values of two offset variables,
// which will be used to calculate the translation amount of the coordinate system
float offset1 = (float)(textSize.Width * System.Math.Sqrt(2) / 4);
float offset2 = (float)(textSize.Height * System.Math.Sqrt(2) / 4);
// Traverse all the pages in the document
foreach (PdfPageBase page in pdf.Pages)
{
// Set the page transparency
page.Canvas.SetTransparency(0.8f);
// Translate the coordinate system by specified coordinates
page.Canvas.TranslateTransform(page.Canvas.Size.Width / 2 - offset1 - offset2, page.Canvas.Size.Height / 2 + offset1 - offset2);
// Rotate the coordinate system 45 degrees counterclockwise
page.Canvas.RotateTransform(-45);
// Draw watermark text on the page
page.Canvas.DrawString(text, font, PdfBrushes.DarkGray, 0, 0);
}
// Save the changes to another file
pdf.SaveToFile("TextWatermark.pdf");
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
// Create a PdfDocument object
PdfDocument pdf = new PdfDocument();
// Load a sample PDF document
pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\sample.pdf");
// Create a PdfTrueTypeFont object
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", 50f), true);
// Set the watermark text
string text = "CONFIDENTIAL";
// Measure the text size
SizeF textSize = font.MeasureString(text);
// Calculate the values of two offset variables,
// which will be used to calculate the translation amount of the coordinate system
float offset1 = (float)(textSize.Width * System.Math.Sqrt(2) / 4);
float offset2 = (float)(textSize.Height * System.Math.Sqrt(2) / 4);
// Traverse all the pages in the document
foreach (PdfPageBase page in pdf.Pages)
{
// Set the page transparency
page.Canvas.SetTransparency(0.8f);
// Translate the coordinate system by specified coordinates
page.Canvas.TranslateTransform(page.Canvas.Size.Width / 2 - offset1 - offset2, page.Canvas.Size.Height / 2 + offset1 - offset2);
// Rotate the coordinate system 45 degrees counterclockwise
page.Canvas.RotateTransform(-45);
// Draw watermark text on the page
page.Canvas.DrawString(text, font, PdfBrushes.DarkGray, 0, 0);
}
// Save the changes to another file
pdf.SaveToFile("TextWatermark.pdf");
Imports System
Imports Spire.Pdf
Imports Spire.Pdf.Graphics
Imports System.Drawing
' Create a PdfDocument object
Private pdf As New PdfDocument()
' Load a sample PDF document
pdf.LoadFromFile("C:\Users\Administrator\Desktop\sample.pdf")
' Create a PdfTrueTypeFont object
Dim font As New PdfTrueTypeFont(New Font("Arial", 50F), True)
' Set the watermark text
Dim text As String = "CONFIDENTIAL"
' Measure the text size
Dim textSize As SizeF = font.MeasureString(text)
' Calculate the values of two offset variables,
' which will be used to calculate the translation amount of the coordinate system
Dim offset1 As Single = CSng(textSize.Width * Math.Sqrt(2) / 4)
Dim offset2 As Single = CSng(textSize.Height * Math.Sqrt(2) / 4)
' Traverse all the pages in the document
For Each page As PdfPageBase In pdf.Pages
' Set the page transparency
page.Canvas.SetTransparency(0.8F)
' Translate the coordinate system by specified coordinates
page.Canvas.TranslateTransform(page.Canvas.Size.Width \ 2 - offset1 - offset2, page.Canvas.Size.Height \ 2 + offset1 - offset2)
' Rotate the coordinate system 45 degrees counterclockwise
page.Canvas.RotateTransform(-45)
' Draw watermark text on the page
page.Canvas.DrawString(text, font, PdfBrushes.DarkGray, 0, 0)
Next page
' Save the changes to another file
pdf.SaveToFile("TextWatermark.pdf")
Spire.PDF の透かし機能は、座標系変換を使用して位置と回転を手動で計算する必要があります。 これにより細かい制御が可能になりますが、グラフィックプログラミングの概念を理解している必要があります。
IronPDF は、位置とデザインの完全な制御を保ちながらテキスト透かしを追加するための簡単な方法を提供します。 IronPDFのHTMLおよびCSSの使用は、これらの言語に精通していればプロセスを容易にします。 Spire.PDFのアプローチは手作業のプロセスが長くなりますが、デザインと位置に対する完全なコントロールを持つ強力な透かしツールを提供します。
PDFに画像やテキストをスタンプする方法は?
IronPDFの例:
using IronPdf;
using IronPdf.Editing;
// Instantiate Renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");
// Create text stamper
TextStamper textStamper = new TextStamper()
{
Text = "Text Stamper!",
FontFamily = "Bungee Spice",
UseGoogleFont = true,
FontSize = 30,
IsBold = true,
IsItalic = true,
VerticalAlignment = VerticalAlignment.Top,
};
// Stamp the text stamper
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");
// Create image stamper
ImageStamper imageStamper = new ImageStamper(new Uri("https://ironpdf.com/img/svgs/iron-pdf-logo.svg"))
{
VerticalAlignment = VerticalAlignment.Top,
};
// Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
using IronPdf;
using IronPdf.Editing;
// Instantiate Renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>");
// Create text stamper
TextStamper textStamper = new TextStamper()
{
Text = "Text Stamper!",
FontFamily = "Bungee Spice",
UseGoogleFont = true,
FontSize = 30,
IsBold = true,
IsItalic = true,
VerticalAlignment = VerticalAlignment.Top,
};
// Stamp the text stamper
pdf.ApplyStamp(textStamper);
pdf.SaveAs("stampText.pdf");
// Create image stamper
ImageStamper imageStamper = new ImageStamper(new Uri("https://ironpdf.com/img/svgs/iron-pdf-logo.svg"))
{
VerticalAlignment = VerticalAlignment.Top,
};
// Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0);
pdf.SaveAs("stampImage.pdf");
Imports IronPdf
Imports IronPdf.Editing
' Instantiate Renderer
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Example HTML Document!</h1>")
' Create text stamper
Private textStamper As New TextStamper() With {
.Text = "Text Stamper!",
.FontFamily = "Bungee Spice",
.UseGoogleFont = True,
.FontSize = 30,
.IsBold = True,
.IsItalic = True,
.VerticalAlignment = VerticalAlignment.Top
}
' Stamp the text stamper
pdf.ApplyStamp(textStamper)
pdf.SaveAs("stampText.pdf")
' Create image stamper
Dim imageStamper As New ImageStamper(New Uri("https://ironpdf.com/img/svgs/iron-pdf-logo.svg")) With {.VerticalAlignment = VerticalAlignment.Top}
' Stamp the image stamper
pdf.ApplyStamp(imageStamper, 0)
pdf.SaveAs("stampImage.pdf")
IronPDF のスタンプ API は、異なるスタンプタイプごとに専用のクラスを使用します。TextStamper は UseGoogleFont プロパティを介して Google Fonts を直接サポートし、ImageStamper は URL またはローカルファイルから画像を読み込むことができます。 Spire.PDFはDOCXからPDFへの変換を直接は扱えませんが、 HTMLスタンパーやバーコード統合を含むスタンプオプションをさらに探索してください。
Spire.PDF(テキストスタンピングの例):
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
// Assumes a PdfDocument is already loaded as `doc` object
PdfPageBase page = doc.Pages[0];
PdfGraphicsState state = page.Canvas.Save();
// Define font and brushes for different effects
PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 18f);
PdfSolidBrush brush1 = new PdfSolidBrush(Color.DeepSkyBlue);
PdfSolidBrush brush2 = new PdfSolidBrush(Color.CadetBlue);
// Apply transformations and draw strings with shadow and effect
page.Canvas.TranslateTransform(20, 200);
page.Canvas.ScaleTransform(1f, 0.6f);
page.Canvas.SkewTransform(-10, 0);
page.Canvas.DrawString("Go! Turn Around! Go! Go! Go!", font, brush1, 0, 0);
page.Canvas.SkewTransform(10, 0);
page.Canvas.DrawString("Go! Turn Around! Go! Go! Go!", font, brush2, 0, 0);
page.Canvas.ScaleTransform(1f, -1f);
page.Canvas.DrawString("Go! Turn Around! Go! Go! Go!", font, brush2, 0, -2 * 18);
// Restore graphics to previous state
page.Canvas.Restore(state);
using Spire.Pdf;
using Spire.Pdf.Graphics;
using System.Drawing;
// Assumes a PdfDocument is already loaded as `doc` object
PdfPageBase page = doc.Pages[0];
PdfGraphicsState state = page.Canvas.Save();
// Define font and brushes for different effects
PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 18f);
PdfSolidBrush brush1 = new PdfSolidBrush(Color.DeepSkyBlue);
PdfSolidBrush brush2 = new PdfSolidBrush(Color.CadetBlue);
// Apply transformations and draw strings with shadow and effect
page.Canvas.TranslateTransform(20, 200);
page.Canvas.ScaleTransform(1f, 0.6f);
page.Canvas.SkewTransform(-10, 0);
page.Canvas.DrawString("Go! Turn Around! Go! Go! Go!", font, brush1, 0, 0);
page.Canvas.SkewTransform(10, 0);
page.Canvas.DrawString("Go! Turn Around! Go! Go! Go!", font, brush2, 0, 0);
page.Canvas.ScaleTransform(1f, -1f);
page.Canvas.DrawString("Go! Turn Around! Go! Go! Go!", font, brush2, 0, -2 * 18);
// Restore graphics to previous state
page.Canvas.Restore(state);
Imports Spire.Pdf
Imports Spire.Pdf.Graphics
Imports System.Drawing
' Assumes a PdfDocument is already loaded as `doc` object
Private page As PdfPageBase = doc.Pages(0)
Private state As PdfGraphicsState = page.Canvas.Save()
' Define font and brushes for different effects
Private font As New PdfFont(PdfFontFamily.Helvetica, 18F)
Private brush1 As New PdfSolidBrush(Color.DeepSkyBlue)
Private brush2 As New PdfSolidBrush(Color.CadetBlue)
' Apply transformations and draw strings with shadow and effect
page.Canvas.TranslateTransform(20, 200)
page.Canvas.ScaleTransform(1F, 0.6F)
page.Canvas.SkewTransform(-10, 0)
page.Canvas.DrawString("Go! Turn Around! Go! Go! Go!", font, brush1, 0, 0)
page.Canvas.SkewTransform(10, 0)
page.Canvas.DrawString("Go! Turn Around! Go! Go! Go!", font, brush2, 0, 0)
page.Canvas.ScaleTransform(1F, -1F)
page.Canvas.DrawString("Go! Turn Around! Go! Go! Go!", font, brush2, 0, -2 * 18)
' Restore graphics to previous state
page.Canvas.Restore(state)
Spire.PDFは、各エフェクトのための手動変換を伴う直接のキャンバス操作を必要とします。 複雑なスタンプを作成するには、グラフィックスステート管理と座標変換を理解する必要があります。
IronPDFのテキストおよび画像スタンピングツールは、スタンプされたコンテンツを適用する際にHTMLおよびCSSに似たアプローチを取る強力で使いやすいスタンプツールです。 Spire.PDFも基本的なテキストスタンピングツールを提供していますが、PDFファイルにスタンプされたテキストを適用するためにはより多くの労力が必要です。
どのライブラリがDOCXからPDFへの変換をうまく処理しますか?
IronPDFの例:
using IronPdf;
// Instantiate Renderer
DocxToPdfRenderer renderer = new DocxToPdfRenderer();
// Render from DOCX file
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");
// Save the PDF
pdf.SaveAs("pdfFromDocx.pdf");
using IronPdf;
// Instantiate Renderer
DocxToPdfRenderer renderer = new DocxToPdfRenderer();
// Render from DOCX file
PdfDocument pdf = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx");
// Save the PDF
pdf.SaveAs("pdfFromDocx.pdf");
Imports IronPdf
' Instantiate Renderer
Private renderer As New DocxToPdfRenderer()
' Render from DOCX file
Private pdf As PdfDocument = renderer.RenderDocxAsPdf("Modern-chronological-resume.docx")
' Save the PDF
pdf.SaveAs("pdfFromDocx.pdf")
IronPDF には、DOCX 変換をネイティブに処理する専用の DocxToPdfRenderer クラスが含まれています。 このAPIはIronPDFの他のレンダリングクラスと一貫しており、基本的な変換にはわずか2行のコードが必要です。 ページ設定やフォーマットの高度なオプションは、レンダラーのプロパティを通じて利用可能です。 DOCXからPDFへの変換機能についてもっと学んでください。
Spire.Docを使用したSpire.PDFによるDOCXからPDFへの変換:
Spire.PDF自体はDOCXをPDFに変換することはできません; ただし、Spire.Docライブラリを使用してこの変換を処理し、その後Spire.PDFを使用して生成されたPDFを操作できます。
using Spire.Doc;
// Create a Document object
Document doc = new Document();
// Load a Word document
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Sample.docx");
// Save the document to PDF
doc.SaveToFile("ToPDF.pdf", FileFormat.PDF);
// Dispose of resources
doc.Dispose();
using Spire.Doc;
// Create a Document object
Document doc = new Document();
// Load a Word document
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Sample.docx");
// Save the document to PDF
doc.SaveToFile("ToPDF.pdf", FileFormat.PDF);
// Dispose of resources
doc.Dispose();
Imports Spire.Doc
' Create a Document object
Private doc As New Document()
' Load a Word document
doc.LoadFromFile("C:\Users\Administrator\Desktop\Sample.docx")
' Save the document to PDF
doc.SaveToFile("ToPDF.pdf", FileFormat.PDF)
' Dispose of resources
doc.Dispose()
このアプローチでは、追加のライブラリ(Spire.Doc)を購入および管理する必要があり、コストと複雑さが増します。
IronPDFは、直接のDOCXからPDFへの変換をサポートしているため、このタスクを処理するために追加のライブラリを必要とせずに、時間を節約できます。 一方、Spire.PDFはDOCXからPDFへの変換を直接扱うことができず、DOCXファイルをPDFに変換するためにSpire.Docライブラリを必要とします。
パフォーマンスメトリクスは何を明らかにしますか?
テストとユーザーのフィードバックに基づいて、ライブラリが実際の使用においてどのように比較されるかは以下の通りです:
レンダリングパフォーマンス
基本のレイアウトの場合、Spire.PDFは静的テーブルや基本スタイルテキストのようなシンプルなコンテンツに最適化されており、これらのユースケースにおいて迅速かつ効率的です。 ただし、モダンなCSS3機能、JavaScript、またはレスポンシブレイアウトを含む複雑なHTMLを扱う場合、IronPDFのChromeベースのエンジンは、やや高いレンダリング時間のコストでより正確な結果を提供します。
メモリ使用量
Spire.PDFは、そのシンプルなレンダリングエンジンのおかげで、IronPDF(150-200MB)と比較して一般的にメモリを少なく使用します(80-120MB)。ただし、これはレンダリングの忠実度や機能サポートのコストが伴います。 メモリが重要でHTMLの複雑さが最小限のアプリケーションにおいて、Spire.PDFは有利かもしれません。
スレッド処理と非同期サポート
IronPDF は、RenderHtmlAsPdfAsync() などのメソッドを使用してネイティブの async/await サポートを提供するため、最新 for .NETアプリケーションに適しています。 開発者は、すべてのIron Softwareの製品にアクセスできるIron Suiteを購入することもできます。
価格とライセンスモデルはどのように比較されますか?
IronPDFの価格とライセンス
IronPDFは、ライセンスを購入するためのさまざまなレベルと追加機能を提供します。 開発者は、すべてのIron Softwareの製品にアクセスできる<あ href="Iron" target="_blank">https://ironsoftware.com/suite/">Iron Suiteを購入することもできます。 ライセンスを購入する準備ができていない場合、IronPDFは30日間の無料トライアルを提供しています。
価格(2025年現在):
- 永久ライセンス: チームの規模、プロジェクトの要件、場所の数に応じて、さまざまな永久ライセンスを提供します。 各ライセンスタイプには電子メールサポートが付属しています。
- Lite ライセンス:このライセンスの料金は $999 で、1 人の開発者、1 つの場所、1 つのプロジェクトをサポートします。
- Plus ライセンス: 3 人の開発者、3 つの場所、3 つのプロジェクトをサポートするこのライセンスは、Lite ライセンスの次のステップであり、料金は $1,499 です。 Plusライセンスは、基本的なメールサポートに加えて、チャットサポートと電話サポートを提供します。 -プロフェッショナル ライセンス:このライセンスは、大規模なチームに適しており、$2,999 の 10 人の開発者、10 か所、10 のプロジェクトをサポートします。 以前の階層と同様の連絡サポートチャンネルを提供し、画面共有サポートも提供しています。 -ロイヤリティフリーの再配布: IronPDF のライセンスでは、追加のロイヤリティフリーの再配布も提供されます。
- 中断のない製品サポート: IronPDF は、継続的な製品の更新やセキュリティ機能のアップグレード、エンジニアリングチームからのサポートへのアクセスを年間 $999 または一回限りの $1,999 で5年間のカバレッジを提供しています。
- Iron Suite : $1,498 では、 IronPDF、 IronOCR、 IronWord、 IronXL、 IronBarcode、 IronQR、 IronZIP、 IronPrint 、IronWebScraper を含むすべてのIron Software製品にアクセスできます。
IronPDF は、永久ライセンスと包括的なサポートを含む柔軟なライセンスオプションを提供しています
Spire.PDF の価格とライセンス
Spire.PDF は、ニーズに応じた様々なライセンスを提供しています。
- 無料バージョン: Spire.PDF は最大10ページのPDFに制限された無料バージョンを提供しています; これを超える場合、有料ライセンスを購入する必要があります。
- 開発者サブスクリプション: サポートの種類に応じて、年間 $999 または $1,199 の価格で、OEM配布権を必要としないPDF関連機能を構築する開発者向けのオプションです。
- 開発者 OEM サブスクリプション: サポートの量に応じて、年間 $2,549 - $4,248 の費用がかかり、無料のアップグレード、プレミアムサポート、およびエンドユーザーへのアプリケーションの配布権を含みます。
- サイト中小企業: サポートの内容に応じて $4,599 または $7,598 の価格で、このライセンスタイアは最大10人の開発者を10か所まで、1年の更新と無料のオンライン技術リソースをサポートしています。
- サイト OEM サブスクリプション: サポートの種類に応じて年間 $13,088 - $16,687 の費用がかかり、多数の拠点にアプリケーションを展開する必要がある大企業向けです。
どちらのライブラリがより優れたドキュメントとサポートを提供しますか?
IronPDF
IronPDF は広範なドキュメントとサポートを提供しています:
- 包括的なドキュメント: すべての機能をカバーする広範でユーザーフレンドリーなドキュメント。
- 24/5 サポート: アクティブなエンジニアサポートが利用可能です。
- ビデオチュートリアル: YouTubeでステップバイステップのビデオガイドが利用可能です。
- コミュニティフォーラム: 追加のサポートのための参加型コミュニティ。
- 定期的な更新: 最新の機能とセキュリティパッチを保証する月次製品更新。
- PDF API リファレンス: API リファレンスを提供し、ツールの最大限の活用が可能です。
詳細については、IronPDF の広範なドキュメントをチェックし、Iron Software YouTube チャンネルを訪問してください。
Spire.PDF for .NET のドキュメントとサポート
- フォーラム: Spire.PDF にはフォーラムがあり、ユーザー同士でヒント、使用例、および Spire.PDF に遭遇した問題を共有できます。
- コードサンプル: Spire.PDF は、製品を様々な用途で使用する方法を示すコード例をウェブサイトで提供しています。
- ニュースレター: Spire.PDF は、更新発表やその他の重要な情報を提供する開発者向けニュースレターを提供しています。
- サポート: サポートは主にフォーラムを通じて行われており、ライセンスバージョンに応じて追加コストが発生する有料のメール/電話サポートが利用可能です。
一般的な開発者体験とフィードバックは?
コミュニティのフィードバックと実際の使用に基づく:
IronPDF のフィードバック
IronPDF は、"より包括的で正確な元のHTMLページの表現を提供する"と開発者に一貫して称賛されています。 ライブラリの複雑なCSS3レイアウト、JavaScriptが多用されたページ、最新のWebフレームワークを処理する能力は、高品質のPDF生成を必要とするアプリケーションにとって優れた選択肢となっています。
共通のポジティブなポイントには以下の点が含まれます:
- 開発時間を短縮できる直感的なAPIデザイン
- ブラウザ出力と一致する優れたレンダリング品質
- 実用的な例を含む包括的なドキュメント
- レスポンシブな技術サポート
Spire.PDF のフィードバック
コミュニティのフィードバックによると、"Spire は単なる画像としてのPDFファイルを生成します。 一部のCSSは正しくさえない場合があり、太字フォントを無視することもあります"。 さらに、JavaScriptサポートは計画中の機能であり、公式のサポートによると"非常に困難であるため短期間で完了しない"とされています。
共通の懸念には以下の点が含まれます:
- 限られたCSS3と最新のWeb標準のサポート
- JavaScript実行機能の欠如
- HTML変換のための複雑なスレッド要件
- 特定の機能に必要な追加ライブラリ
各ライブラリを選ぶべき時は?
IronPDFを選ぶとき:
- HTMLにモダンなCSS3、JavaScript、またはレスポンシブデザインが含まれている場合
- ピクセルパーフェクトなブラウザ出力に一致するレンダリングが必要な場合
- クロスプラットフォーム展開が必要な場合(Linux、macOS、Docker)
- ライセンスに含まれる包括的なサポートを希望する場合
- 追加ライブラリを必要とせずにDOCX変換のようなビルトイン機能が必要な場合
- チームが最小限のコードで迅速な開発を重視する場合
Spire.PDFを選ぶとき:
- PDFがシンプルなスタイリングの基本的なHTMLを含む場合
- メモリ使用量が重要な制約である場合
- 主にWindows環境で作業している場合
- HTMLがJavaScriptの実行を必要としない場合
- スタックに他のIron製品をすでに使用している場合
結論
結論として、IronPDF と Spire.PDF for .NET は.NETアプリケーションでPDFドキュメントを扱うためのどちらも有能なツールです。 IronPDF は使いやすさ、クロスプラットフォームの互換性、モダンなWeb標準のサポートに優れており、PDFドキュメントを扱う際にステップアップしたい場合は優れた選択肢となります。 Spire.PDF は包括的な機能セットを提供していますが、複雑なタスクにはより多くの努力が必要で、最新のウェブアプリケーションが要求するレンダリングの精度が欠けています。
現代のウェブ技術を扱う開発者、正確なHTMLからPDFへの変換を必要とする方、信頼性のあるクロスプラットフォームサポートを求める方には、IronPDFがより完全なソリューションを提供します。 そのChromeに基づいたレンダリングエンジン、直感的なAPI、および包括的なサポートにより、企業アプリケーションや複雑なドキュメント生成のシナリオに特に適しています。
30日間の無料トライアル をお試しください。
よくある質問
C# で HTML を PDF に変換するにはどうすればいいですか?
IronPDF の RenderHtmlAsPdf メソッドを使用して、HTML 文字列を PDF に変換できます。RenderHtmlFileAsPdf を使用して HTML ファイルを PDF に変換することもできます。
IronPDF は HTML から PDF への変換中に JavaScript の実行をサポートしていますか?
はい、IronPDF は完全な JavaScript 実行をサポートしており、動的コンテンツまたは JavaScript に依存するレイアウトを PDF に変換するのに理想的です。
IronPDF は PDF 変換をサポートするプラットフォームはどれですか?
IronPDF は、Windows、Linux、macOS、Docker、また Azure や AWS のようなクラウド サービスを含む複数のプラットフォームでのネイティブサポートを提供します。
IronPDF のメモリ使用量は Spire.PDF と比較してどうですか?
IronPDFは、Spire.PDFの80-120MBと比較して、通常150-200MBのわずかに多くのメモリを使用しますが、より良いレンダリング品質を提供し、最新のasync/awaitパターンをサポートします。
IronPDF は DOCX ファイルを直接 PDF に変換できますか?
はい、IronPDF は追加のライブラリを必要とせずに DocxToPdfRenderer クラスを通じて組み込みの DOCX から PDF への変換機能を含んでいます。
IronPDF のライセンスオプションはどのようになっていますか?
IronPDFは、すべての機能とサポートを含む、シングル開発者向けに749ドルから始まる永続ライセンスを提供しています。また、9製品を含むIron Suiteバンドルを1,498ドルで提供しています。
IronPDFはどのようなサポートを提供していますか?
IronPDF は、すべてのライセンスに対してメール、チャット、電話、および画面共有を通じて 24/5 のエンジニアリングサポートを提供し、包括的な支援を保証します。
IronPDF で PDF のセキュリティと暗号化を確保するにはどうすればよいですか?
IronPDF は AES-256 暗号化とパスワード保護を SecuritySettings クラスを通じてサポートし、PDF の権限に対する詳細な制御を可能にします。
IronPDF は、現代の CSS を備えた複雑なウェブページのレンダリングに適していますか?
はい、IronPDF は CSS3、flexbox、グリッドレイアウト、Webフォント、および JavaScript をサポートする完全な Chrome レンダリング エンジンを使用しており、複雑なウェブページに適しています。
IronPDFの無料版の制限は何ですか?
IronPDF は、すべての機能を試すのに十分な機会を提供するページ制限のない完全機能の30日間無料試用版を提供します。
IronPDF はどのようにして高品質な HTML レンダリングを確保しますか?
IronPDF は、Chrome ブラウザの出力に一致するピクセルパーフェクトなレンダリングを提供し、元の HTML コンテンツの高忠実度および正確な表現を保証します。



