Gotenberg vs IronPDF:技術比較ガイド
Gotenbergvs IronPDF:Dockerマイクロサービスとインプロセス.NETライブラリの比較
.NET開発者がPDF生成ソリューションを評価するとき、GotenbergはREST APIコールでHTMLをPDFに変換するDockerベースのマイクロサービスとして登場します。 Gotenbergは、ポリグロット・アーキテクチャには柔軟ですが、インフラストラクチャ・オーバーヘッド(Dockerコンテナ、ネットワーク遅延、運用の複雑さ)が大きくなります。 IronPdfは異なるアプローチを提供します:プロセス内のNuGetパッケージは、コンテナ、ネットワーク呼び出し、インフラストラクチャ管理なしで同じChromiumベースのレンダリングを提供します。
この比較では、プロの開発者やアーキテクトが.NET PDFの要件について十分な情報を得た上で決定できるように、技術的に関連する次元で両方のソリューションを検証します。
Gotenbergを理解する。
Gotenbergは、PDF生成のためのDockerベースのマイクロサービスアーキテクチャです。 HTML、URL、その他のフォーマットをPDFに変換するためのREST APIエンドポイントを公開する別のコンテナとして動作します。 すべてのPDF操作は、GotenbergサービスへのHTTPコールを必要とします。
Gotenbergは、HTMLからPDFへの変換にPOST /forms/chromium/convert/html、URLからPDFへの変換にPOST /forms/chromium/convert/urlのようなエンドポイントを使用します。 設定は、paperWidth、paperHeight、marginTop、marginBottom(インチ)のような文字列ベースのパラメータを持つmultipart/form-dataを介して渡されます。 このサービスには、Dockerのデプロイ、コンテナのオーケストレーション(Kubernetes/Docker Compose)、ネットワークインフラが必要です。
アーキテクチャ
- Dockerコンテナのデプロイと管理
- PDFリクエストごとにネットワーク通信(10-100ms以上のレイテンシ)
- コンテナのコールドスタート処理(最初のリクエストは2~5秒)
- ヘルスチェックエンドポイントとサービスモニタリング
- すべてのリクエストに対するMultipart/form-dataの構築
IronPDFの理解
IronPdfはNuGetパッケージとしてインプロセスで動作する.NETネイティブライブラリです。 ChromiumベースのHTMLレンダリングを提供し、外部サービス、ネットワークコール、コンテナインフラストラクチャを必要としません。
IronPDFはRenderHtmlAsPdf()やRenderUrlAsPdf()のようなメソッドを持つ主要なレンダリングクラスとしてChromePdfRendererを使用します。 設定は、PaperSize、MarginTop、MarginBottom(ミリメートル単位)を含むRenderingOptionsの型付きC#プロパティを使用します。 ドキュメントはSaveAs()で保存されるか、BinaryDataとしてアクセスされます。
ライブラリに必要なのは
- NuGetパッケージのインストール (
dotnet add package IronPdf) - ライセンスキー設定
- .NET プロジェクトの標準セットアップ
アーキテクチャとインフラストラクチャの比較
これらのソリューションの基本的な違いは、デプロイとランタイムのアーキテクチャにあります。
| ファクター | Gotenberg | IronPDF |
|---|---|---|
| デプロイメント | Dockerコンテナ+オーケストレーション | 単一のNuGetパッケージ |
| アーキテクチャ | マイクロサービス(REST API) | インプロセスライブラリ |
| 10-100ms以上(ネットワーク・ラウンドトリップ) | <1msのオーバーヘッド | |
| コールドスタート。 | 2~5秒(コンテナinit) | 1~2秒(最初のレンダリングのみ) |
| インフラストラクチャ | Docker、Kubernetes、ロードバランサー | 不要 |
| ネットワーク依存性。 | 必須 | なし |
| 失敗モード | ネットワーク、コンテナ、サービス障害 | .NET 標準の例外 |
| APIスタイル。 | REST multipart/form-data | C#ネイティブメソッドコール |
| スケーリング。 | 水平方向(コンテナを増やす) | 垂直方向(進行中) |
| デバッグ。 | 分散トレーシング | 標準デバッガ |
| メモリ管理。 | 別コンテナ(512MB~2GB) | 共有アプリケーションメモリ |
| バージョン管理。 | コンテナ画像タグ | NuGetパッケージのバージョン |
| 健康チェック。 | 必要なHTTPエンドポイント | 不要(進行中) |
| CI/CDの複雑さ。 | コンテナのビルド、レジストリのプッシュ | .NET 標準ビルド |
GotenbergのDockerベースのアプローチでは、コンテナのデプロイ、ヘルスモニタリング、ネットワークインフラ管理が必要です。 IronPdfはインプロセスで実行することにより、このインフラレイヤーを完全に排除します。
コードの比較:一般的なPDF操作
基本的なHTMLからPDFへの変換
最も基本的な操作は、アーキテクチャの違いを明確に示します。
Gotenberg:(英語
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.IO;
class GotenbergExample
{
static async Task Main()
{
var gotenbergUrl = "http://localhost:3000/forms/chromium/convert/html";
using var client = new HttpClient();
using var content = new MultipartFormDataContent();
var html = "<html><body><h1>Hello from Gotenberg</h1></body></html>";
content.Add(new StringContent(html), "files", "index.html");
var response = await client.PostAsync(gotenbergUrl, content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("output.pdf", pdfBytes);
Console.WriteLine("PDF generated successfully");
}
}using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.IO;
class GotenbergExample
{
static async Task Main()
{
var gotenbergUrl = "http://localhost:3000/forms/chromium/convert/html";
using var client = new HttpClient();
using var content = new MultipartFormDataContent();
var html = "<html><body><h1>Hello from Gotenberg</h1></body></html>";
content.Add(new StringContent(html), "files", "index.html");
var response = await client.PostAsync(gotenbergUrl, content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("output.pdf", pdfBytes);
Console.WriteLine("PDF generated successfully");
}
}IRON VB CONVERTER ERROR developers@ironsoftware.comIronPDF:
// NuGet: Install-Package IronPdf
using System;
using IronPdf;
class IronPdfExample
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var html = "<html><body><h1>Hello from IronPDF</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF generated successfully");
}
}// NuGet: Install-Package IronPdf
using System;
using IronPdf;
class IronPdfExample
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var html = "<html><body><h1>Hello from IronPDF</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF generated successfully");
}
}IRON VB CONVERTER ERROR developers@ironsoftware.comGotenberg では、HttpClient を作成し、MultipartFormDataContent を構築し、HTML を特定のファイル名(index.html)で添付ファイルとして追加し、Gotenberg サービス・エンドポイントに非同期 HTTP POST を行い、レスポンス・バイトを読み取り、ディスクに書き込む必要があります。 すべてのリクエストはネットワークを経由し、それに伴う遅延や障害モードが発生します。
IronPDFはChromePdfRendererを作成し、HTML文字列でRenderHtmlAsPdf()を呼び出し、SaveAs()で保存します。 操作は同期、インプロセスで、文字列ベースのフォームデータではなく、型付けされたメソッドを使用します。
高度なHTMLレンダリングオプションについては、HTMLからPDFへの変換ガイドをご覧ください。
URLからPDFへの変換
ライブのウェブページをPDFに変換すると、似たようなアーキテクチャパターンが見られます。
Gotenberg:(英語
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.IO;
class GotenbergUrlToPdf
{
static async Task Main()
{
var gotenbergUrl = "http://localhost:3000/forms/chromium/convert/url";
using var client = new HttpClient();
using var content = new MultipartFormDataContent();
content.Add(new StringContent("https://example.com"), "url");
var response = await client.PostAsync(gotenbergUrl, content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("webpage.pdf", pdfBytes);
Console.WriteLine("PDF from URL generated successfully");
}
}using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.IO;
class GotenbergUrlToPdf
{
static async Task Main()
{
var gotenbergUrl = "http://localhost:3000/forms/chromium/convert/url";
using var client = new HttpClient();
using var content = new MultipartFormDataContent();
content.Add(new StringContent("https://example.com"), "url");
var response = await client.PostAsync(gotenbergUrl, content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("webpage.pdf", pdfBytes);
Console.WriteLine("PDF from URL generated successfully");
}
}IRON VB CONVERTER ERROR developers@ironsoftware.comIronPDF:
// NuGet: Install-Package IronPdf
using System;
using IronPdf;
class IronPdfUrlToPdf
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://example.com");
pdf.SaveAs("webpage.pdf");
Console.WriteLine("PDF from URL generated successfully");
}
}// NuGet: Install-Package IronPdf
using System;
using IronPdf;
class IronPdfUrlToPdf
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://example.com");
pdf.SaveAs("webpage.pdf");
Console.WriteLine("PDF from URL generated successfully");
}
}IRON VB CONVERTER ERROR developers@ironsoftware.comGotenbergは、/forms/chromium/convert/urlエンドポイントを使用し、URLはフォームデータとして渡されます。 IronPDFはURL文字列で直接RenderUrlAsPdf()を呼び出します。
ページサイズと余白のカスタマイズ
コンフィギュレーション処理では、API設計の違いを明らかにします。
Gotenberg:(英語
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.IO;
class GotenbergCustomSize
{
static async Task Main()
{
var gotenbergUrl = "http://localhost:3000/forms/chromium/convert/html";
using var client = new HttpClient();
using var content = new MultipartFormDataContent();
var html = "<html><body><h1>Custom Size PDF</h1></body></html>";
content.Add(new StringContent(html), "files", "index.html");
content.Add(new StringContent("8.5"), "paperWidth");
content.Add(new StringContent("11"), "paperHeight");
content.Add(new StringContent("0.5"), "marginTop");
content.Add(new StringContent("0.5"), "marginBottom");
var response = await client.PostAsync(gotenbergUrl, content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("custom-size.pdf", pdfBytes);
Console.WriteLine("Custom size PDF generated successfully");
}
}using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.IO;
class GotenbergCustomSize
{
static async Task Main()
{
var gotenbergUrl = "http://localhost:3000/forms/chromium/convert/html";
using var client = new HttpClient();
using var content = new MultipartFormDataContent();
var html = "<html><body><h1>Custom Size PDF</h1></body></html>";
content.Add(new StringContent(html), "files", "index.html");
content.Add(new StringContent("8.5"), "paperWidth");
content.Add(new StringContent("11"), "paperHeight");
content.Add(new StringContent("0.5"), "marginTop");
content.Add(new StringContent("0.5"), "marginBottom");
var response = await client.PostAsync(gotenbergUrl, content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("custom-size.pdf", pdfBytes);
Console.WriteLine("Custom size PDF generated successfully");
}
}IRON VB CONVERTER ERROR developers@ironsoftware.comIronPDF:
// NuGet: Install-Package IronPdf
using System;
using IronPdf;
using IronPdf.Rendering;
class IronPdfCustomSize
{
static void Main()
{
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = PdfPaperSize.Letter;
renderer.RenderingOptions.MarginTop = 50;
renderer.RenderingOptions.MarginBottom = 50;
var html = "<html><body><h1>Custom Size PDF</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("custom-size.pdf");
Console.WriteLine("Custom size PDF generated successfully");
}
}// NuGet: Install-Package IronPdf
using System;
using IronPdf;
using IronPdf.Rendering;
class IronPdfCustomSize
{
static void Main()
{
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = PdfPaperSize.Letter;
renderer.RenderingOptions.MarginTop = 50;
renderer.RenderingOptions.MarginBottom = 50;
var html = "<html><body><h1>Custom Size PDF</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("custom-size.pdf");
Console.WriteLine("Custom size PDF generated successfully");
}
}IRON VB CONVERTER ERROR developers@ironsoftware.comGotenbergは、マルチパートのフォームデータに追加された文字列ベースのパラメータ("8.5"、"11"、"0.5")を使用します。 用紙寸法はインチです。 各パラメータは個別の Add() 呼び出しで、型チェックやインテリセンスのサポートはありません。
IronPDFはRenderingOptionsの型付きプロパティを使用します。 PaperSizeは列挙型(PdfPaperSize.Letter)を受け入れ、余白はミリメートル単位の数値です。 型付きAPIは、コンパイル時のチェックとIDEのサポートを提供します。
レンダリングの設定については、IronPDFチュートリアルをご覧ください。
APIマッピングリファレンス
Gotenbergの移行を評価したり、機能を比較したりする開発者のために、このマッピングは同等の操作を示します:
エンドポイントからメソッドへのマッピング
| 御殿場ルート | IronPDF 同等物 | ノート |
|---|---|---|
POST /forms/chromium/convert/html。 | ChromePdfRenderer.RenderHtmlAsPdf()のようになります。 | HTML文字列からPDFへ |
POST /forms/chromium/convert/url | ChromePdfRenderer.RenderUrlAsPdf()のようにします。 | URLからPDFへ |
POST /forms/chromium/convert/markdown。 | 最初にMarkdownをHTMLとしてレンダリング | Markdigライブラリを使用 |
POST /forms/pdfengines/merge | PdfDocument.Merge()を使用してください。 | 複数のPDFをマージ |
POST /forms/pdfengines/metadata/read | <コード>pdf.MetaData</コード | メタデータを読む |
POST /forms/pdfengines/metadata/write | pdf.MetaData.Author = "...". | メタデータを書く |
GET /health | 該当なし | 外部サービス不要 |
フォーム パラメータと RenderingOptions のマッピング
| Gotenberg パラメータ | IronPDF プロパティ | 変換に関する注意事項 |
|---|---|---|
| <コード>paperWidth</コード> (インチ) | RenderingOptions.SetCustomPaperSizeInInches(). | カスタム |
| <コード>paperHeight</コード> (インチ) | RenderingOptions.SetCustomPaperSizeInInches(). | カスタム |
マージントップ (インチ) | RenderingOptions.MarginTop。 | mmは25.4倍 |
マージンボトム (インチ) | RenderingOptions.MarginBottom。 | mmは25.4倍 |
marginLeft (インチ) | RenderingOptions.MarginLeft(レンダリングオプション.マージンレフト)。 | mmは25.4倍 |
| <コード>marginRight</コード> (インチ) | <コード>RenderingOptions.MarginRight</コード | mmは25.4倍 |
| <コード>printBackground</コード | RenderingOptions.PrintHtmlBackgroundsを使用してください。 | ブーリアン |
| <コード>風景</コード | <コード>RenderingOptions.PaperOrientation</コード | ランドスケープ列挙 |
| <コード>スケール</コード | <コード>RenderingOptions.Zoom</コード | パーセンテージ(100 = 1.0) |
| <コード>waitDelay</コード | RenderingOptions.RenderDelayとなります。 | ミリ秒への変換 |
| <コード>emulatedMediaType</コード | <コード>RenderingOptions.CssMediaType</コード | スクリーンまたはプリント。 |
単位変換に注意してください:Gotenbergは余白にインチを使用しています(例:"0.5" = 0.5インチ = 12.7mm)が、IronPDFはミリメートルを使用しています。
インフラストラクチャの比較
ゴテンバーグDocker Compose
Gotenberg はコンテナ・インフラを必要とします:
#Gotenbergrequires container management
version: '3.8'
services:
app:
depends_on:
- gotenberg
environment:
- GOTENBERG_URL=http://gotenberg:3000
gotenberg:
image: gotenberg/gotenberg:8
ports:
- "3000:3000"
deploy:
resources:
limits:
memory: 2G
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s#Gotenbergrequires container management
version: '3.8'
services:
app:
depends_on:
- gotenberg
environment:
- GOTENBERG_URL=http://gotenberg:3000
gotenberg:
image: gotenberg/gotenberg:8
ports:
- "3000:3000"
deploy:
resources:
limits:
memory: 2G
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30sIronPDFの設定
IronPDFは追加サービスを必要としません:
#IronPDF- No additional services needed
version: '3.8'
services:
app:
environment:
- IRONPDF_LICENSE_KEY=${IRONPDF_LICENSE_KEY}
# NoGotenbergservice. No health checks. No resource limits.#IronPDF- No additional services needed
version: '3.8'
services:
app:
environment:
- IRONPDF_LICENSE_KEY=${IRONPDF_LICENSE_KEY}
# NoGotenbergservice. No health checks. No resource limits.インフラストラクチャの違いも大きい:Gotenberg は、コンテナのデプロイ、ヘルス・モニタリング、リソースの割り当て、サービスの依存関係を必要とします。 IronPdfはアプリケーションのインプロセスで実行されます。
パフォーマンスの特徴
| 手術 | Gotenberg(ウォームコンテナ) | Gotenberg(コールドスタート) | IronPDF (ファーストレンダリング) | IronPDF (後続) |
|---|---|---|---|---|
| シンプルなHTML | 150-300ms | 2~5秒 | 1~2秒 | 50-150ms |
| 複雑なHTML | 500-1500ms | 3~7秒 | 1.5-3秒 | 200-800ms |
| URLレンダー | 1~5秒 | 3~10秒 | 1~5秒 | 500ms-3s |
| PDFマージ | 200-500ms | 2~5秒 | 100-300ms | 100-300ms |
Gotenberg のネットワーク・ラウンドトリップは、リクエストごとに 10~100ms を超えます。コンテナのコールドスタートは 2~5 秒追加されます。 IronPdfの最初のレンダリングではChromiumの初期化(1-2秒)が発生しますが、それ以降のレンダリングではオーバーヘッドは最小限です。
チームがGotenbergからIronPDFへの移行を検討するとき
開発チームがGotenbergからIronPDFへの移行を評価する理由はいくつかあります:
インフラストラクチャ・オーバーヘッド:Gotenbergには、Docker、コンテナオーケストレーション(Kubernetes/Docker Compose)、サービスディスカバリー、ロードバランシングが必要です。 よりシンプルなデプロイメントを求めるチームは、IronPdfのNuGetのみのアプローチにより、このようなインフラの懸念が解消されることに気づきます。
ネットワーク遅延:GotenbergPDFの操作のたびに、別のサービスへのHTTP呼び出しが必要になります。大量のアプリケーションでは、このオーバーヘッドが蓄積されます。 IronPDFのインプロセスアプローチは初期化後のオーバーヘッドはごくわずかです。
コールドスタートの問題:コンテナのスタートアップは、最初のリクエストに2-5秒を追加する可能性があります。 暖かいコンテナにもネットワーク・オーバーヘッドがあります。 ポッドの再起動、スケールアップイベント、デプロイのたびに、コールドスタートがトリガーされます。 IronPdfのコールドスタートはアプリケーションのライフタイムに一度だけ発生します。
運用の複雑さ:Gotenberg では、コンテナの健全性、スケーリング、ロギング、およびモニタリングを個別の問題として管理する必要があります。 ネットワークのタイムアウト、サービスの利用不能、コンテナのクラッシュがアプリケーションの懸念事項になります。 IronPDFは標準的な.NETの例外処理を使用します。
マルチパートフォームデータAPI: Gotenbergのリクエストはすべて、文字列ベースのパラメータでマルチパート/フォームデータのペイロードを構築する必要があります。 IronPDFはインテリセンスをサポートした型付きC#プロパティを提供します。
バージョン管理:Gotenberg 画像はアプリケーションとは別に更新されます。 APIの変更は、統合を壊す可能性があります。 IronPDFのバージョンはNuGetを通して標準的な.NET依存関係管理で管理されます。
長所と考慮点
ゴテンベルクの強み
- ポリグロット・アーキテクチャ:HTTPコールが可能なすべての言語で動作
- 言語にとらわれない:.NETエコシステムに縛られない。
- MITライセンス:フリーおよびオープンソース
- マイクロサービスパターン:コンテナ型アーキテクチャに適合
ゴテンベルクの考察
- インフラストラクチャ・オーバーヘッド:Docker、Kubernetes、ロードバランサーが必要です。
- ネットワーク遅延:リクエストあたり10-100ms以上
- コールドスタート:2~5秒のコンテナ初期化
- 文字列ベースのAPI: 型安全性やインテリセンスはありません。
- 分散デバッグ:分散トレースが必要
- ヘルスモニタリング:管理するエンドポイントの追加
IronPDFの強み
IronPDFについての考察
- .NET固有:.NETエコシステム向けに設計
- 商用ライセンス:本番使用時に必要です。
結論
GotenbergとIronPDFは、.NETアプリケーションでのPDF生成において根本的に異なるアプローチを表しています。 GotenbergのDockerベースのマイクロサービス・アーキテクチャは、コンテナ管理、ネットワーク遅延、運用の複雑さを導入しています。 すべてのPDF操作は、関連する障害モードとコールドスタートのペナルティを伴うHTTP通信を必要とします。
IronPDFは同じChromiumベースのレンダリングをインプロセスライブラリとして提供します。 NuGetパッケージは、Dockerコンテナ、ネットワークコール、インフラストラクチャ管理を排除します。 型付きC# APIは、文字列ベースのマルチパートフォームデータを置き換えます。 .NET標準の例外処理は、HTTPステータスコードとネットワーク障害モードに取って代わります。
組織が.NET 10、C# 14、および2026年までのアプリケーション開発を計画する中で、マイクロサービスのインフラストラクチャオーバーヘッドとインプロセスライブラリのシンプルさのどちらを選択するかは、デプロイと運用の複雑さに大きく影響します。 HTML/CSS/JavaScriptのレンダリングに忠実でありながら、インフラストラクチャの負担を軽減しようとするチームは、IronPdfがこれらの要件に効果的に対応することを発見するでしょう。
無料トライアルでIronPDFの評価を開始し、包括的なドキュメントを参照して、特定の要件への適合性を評価してください。