NET MAUI で XAML を PDF に変換する方法
なぜpdforgeからIronPDFに移行するのか
pdforgeを理解する
pdforge (2026年に"pdf noodle"にリブランド — pdfnoodle.com; 2026年末まで301リダイレクトでapi.pdforge.comホスト名は機能し続けます) — HTTPコールを介してアプリケーションに統合することでPDFファイルを生成する、クラウドベースでテンプレート駆動のPDF生成APIです。 NuGetには公式 for .NET SDKがありません — 統合はドキュメント化されたRESTエンドポイントに対してHttpClientで行います。 PDF作成のタスクを外部APIにオフロードすることで、開発者は開発プロセスを簡素化することができます。 しかし、pdforgeには、外部依存性、カスタマイズオプションの制限、継続的なサブスクリプション費用など、開発者が注意すべき欠点があります。
クラウド API の依存性の問題
pdforgeは、すべてのドキュメントを外部のクラウドサーバーで処理します。 このアーキテクチャーは、本番アプリケーションに大きな懸念をもたらします:
1.外部サーバー処理:生成するすべての PDF では、HTML/データを pdforge のサーバーに送信する必要があり、ドキュメントはインフラストラクチャから出ていきます。
2.プライバシーとコンプライアンスのリスク:機密データはインターネット経由でサードパーティのサーバーに送信されます。 pdforgeを使用する場合、開発者はデータが外部APIに送信されることに関連するセキュリティ上の懸念に対応する必要があります。 PDFのコンテンツに機密情報が含まれている場合、これは重要な考慮事項となります。
3.継続的なサブスクリプション費用:資産の所有権がなく、月額料金は無期限に蓄積されます。pdforge の SaaS モデルでは、時間の経過とともに蓄積される可能性のある継続的な運用コストが発生します。
4.インターネット依存性:ネットワークが利用できない場合は PDF は生成されません。
5.レート制限: API 使用量の上限により、大量のアプリケーションが制限される可能性があります。
6.ネットワーク遅延:ラウンドトリップ時間により、PDF 生成ごとに数秒が追加されます。
pdforgeとIronPDFの比較
| フィーチャー | pdforge | IronPDF |
|---|---|---|
| 展開タイプ | クラウドベースのAPI | ローカルライブラリ |
| 依存関係について | インターネットおよびAPI認証が必要です。 | 外部依存なし |
| カスタマイズ。 | PDF生成の制御が制限されている | カスタマイズの完全制御 |
| コスト構造 | 継続的な購読 | 1回限りの購入オプション |
| セキュリティ。 | ウェブ上で送信されるデータに関する潜在的な懸念 | データ処理を完全にローカル環境内に保持 |
| セットアップの複雑さ | 外部処理による初期設定の容易化 | 初期設定と構成が必要 |
IronPDFは完全にローカルなライブラリを提供し、開発者がPDF作成プロセスを完全にコントロールできるようにすることで差別化を図っています。 これは、ファイルの内部処理が優先されるアプリケーションや、外部API呼び出しによってセキュリティ上の懸念が生じるアプリケーションで特に有利です。 IronPDFはすべてをローカルで処理し、そのようなリスクを最小限に抑えます。
.NET 10およびC# 14の採用を計画しているチームにとっては、IronPDFはクラウド依存を排除しながら、包括的なPDF操作機能を追加するローカル処理基盤を提供します。
始める前に
前提条件
- .NET環境: .NET Framework 4.6.2+ または.NET Core 3.1+ / .NET 5/6/7/8/9+
- NuGetアクセス: NuGetパッケージをインストールする機能
- IronPDFライセンス: IronPDFからライセンスキーを取得します。
NuGetパッケージの変更
# pdforge has no official .NET SDK on NuGet — integration is HttpClient + JSON.
# If your project depends only on built-in System.Net.Http, there is no
# competitor package to remove. Just install IronPDF:
dotnet add package IronPdf
# pdforge has no official .NET SDK on NuGet — integration is HttpClient + JSON.
# If your project depends only on built-in System.Net.Http, there is no
# competitor package to remove. Just install IronPDF:
dotnet add package IronPdf
ライセンス構成
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
' Add at application startup (Program.vb or Startup.vb)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
pdforgeの使用法を特定する
# Find pdforge / pdf noodle endpoint usage
grep -r "api\.pdforge\.com\|api\.pdfnoodle\.com" --include="*.cs" .
# Find API key / Bearer token references
grep -r "pdfnoodle_api_\|pdforge_api_" --include="*.cs" --include="*.json" --include="*.config" .
# Find Chromium header/footer templates that need migrating
grep -r "totalPages\|pageNumber\|footerTemplate\|headerTemplate" --include="*.cs" .
# Find pdforge / pdf noodle endpoint usage
grep -r "api\.pdforge\.com\|api\.pdfnoodle\.com" --include="*.cs" .
# Find API key / Bearer token references
grep -r "pdfnoodle_api_\|pdforge_api_" --include="*.cs" --include="*.json" --include="*.config" .
# Find Chromium header/footer templates that need migrating
grep -r "totalPages\|pageNumber\|footerTemplate\|headerTemplate" --include="*.cs" .
完全な API リファレンス
名前空間の変更
// Before: pdforge — raw HttpClient against api.pdfnoodle.com
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
// After: IronPDF
using IronPdf;
using IronPdf.Rendering;
// Before: pdforge — raw HttpClient against api.pdfnoodle.com
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
// After: IronPDF
using IronPdf;
using IronPdf.Rendering;
Imports System.Net.Http
Imports System.Net.Http.Headers
Imports System.Text
Imports System.Text.Json
Imports IronPdf
Imports IronPdf.Rendering
コアコンセプトのマッピング
| pdforge (REST) | IronPDF |
|---|---|
HttpClient + Authorization: Bearer pdfnoodle_api_... |
new ChromePdfRenderer() |
POST https://api.pdfnoodle.com/v1/html-to-pdf/sync |
renderer.RenderHtmlAsPdf(html) |
JSONボディ { html, pdfParams } |
ChromePdfRenderer + RenderingOptions |
レスポンス: JSONエンベロープ with signedUrl |
PdfDocument |
Return: byte[] (signedUrlを取得した後) |
pdf.BinaryData |
オペレーションマッピング
| pdforge | IronPDF |
|---|---|
POST /v1/html-to-pdf/sync with { html } |
renderer.RenderHtmlAsPdf(html) |
| URLをフェッチし、そのHTMLをPOST(専用のURLエンドポイントはありません) | renderer.RenderUrlAsPdf(url) |
signedUrl をダウンロードしてから File.WriteAllBytes(path, bytes) |
pdf.SaveAs(path) |
await http.GetByteArrayAsync(signedUrl) |
pdf.BinaryData |
構成マッピング
pdforge pdfParams |
IronPDF (RenderingOptions) |
|---|---|
format: "A4" |
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4 |
landscape: true |
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape |
margin: { top: "20px" } |
renderer.RenderingOptions.MarginTop = 20 |
footerTemplate with <span class="pageNumber"> / <span class="totalPages"> |
TextFooter = new TextHeaderFooter { CenterText = "Page {page} of {total-pages}" } |
pdforgeでは利用できない新機能
| IronPDFの特徴 | 翻訳内容 |
|---|---|
PdfDocument.Merge() |
複数のPDFを結合 |
pdf.ExtractAllText() |
PDFからのテキスト抽出 |
pdf.ApplyWatermark() |
透かしの追加 |
pdf.SecuritySettings |
パスワード保護 |
pdf.Form |
フォーム入力 |
pdf.SignWithDigitalSignature() |
デジタル署名 |
コード移行の例
例1: HTML文字列からPDFへの変換
ビフォア(pdforge):。
// REST API — no .NET SDK on NuGet. Integration is HttpClient + JSON POST.
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY");
var body = new { html = "<html><body><h1>Hello World</h1></body></html>" };
var json = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json");
var resp = await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json);
resp.EnsureSuccessStatusCode();
using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
var pdfBytes = await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString());
File.WriteAllBytes("output.pdf", pdfBytes);
}
}
// REST API — no .NET SDK on NuGet. Integration is HttpClient + JSON POST.
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY");
var body = new { html = "<html><body><h1>Hello World</h1></body></html>" };
var json = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json");
var resp = await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json);
resp.EnsureSuccessStatusCode();
using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
var pdfBytes = await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString());
File.WriteAllBytes("output.pdf", pdfBytes);
}
}
Imports System.IO
Imports System.Net.Http
Imports System.Net.Http.Headers
Imports System.Text
Imports System.Text.Json
Imports System.Threading.Tasks
Module Program
Async Function Main() As Task
Using http As New HttpClient()
http.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY")
Dim body = New With {.html = "<html><body><h1>Hello World</h1></body></html>"}
Dim json As New StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json")
Dim resp = Await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json)
resp.EnsureSuccessStatusCode()
Using doc = JsonDocument.Parse(Await resp.Content.ReadAsStringAsync())
Dim pdfBytes = Await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString())
File.WriteAllBytes("output.pdf", pdfBytes)
End Using
End Using
End Function
End Module
翻訳後(IronPDF):。
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var html = "<html><body><h1>Hello World</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var html = "<html><body><h1>Hello World</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
}
}
Imports IronPdf
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim html = "<html><body><h1>Hello World</h1></body></html>"
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("output.pdf")
End Sub
End Class
ここでの基本的な違いは、処理モデルと戻り値の型です。 pdforgeは、https://api.pdfnoodle.com/v1/html-to-pdf/syncに要求します。これにより、署名されたS3 URLを含むJSONエンベロープが返されます — そのURLからPDFバイトを取得し、File.WriteAllBytes()で書き込みます。
IronPDFはPdfDocumentオブジェクトを返します。 このオブジェクトはpdf.BinaryDataにアクセスできます。 PdfDocumentは保存前に操作(ウォーターマークの追加、他のPDFとのマージ、セキュリティの追加)が可能です。 包括的な例については、HTML to PDF documentationを参照してください。
例2: URLからPDFへの変換
ビフォア(pdforge):。
// REST API — no .NET SDK on NuGet. pdforge has no dedicated URL endpoint;
// fetch the page yourself and POST its HTML to /v1/html-to-pdf/sync.
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY");
var sourceHtml = await http.GetStringAsync("https://example.com");
var body = new { html = sourceHtml };
var json = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json");
var resp = await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json);
resp.EnsureSuccessStatusCode();
using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
var pdfBytes = await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString());
File.WriteAllBytes("webpage.pdf", pdfBytes);
}
}
// REST API — no .NET SDK on NuGet. pdforge has no dedicated URL endpoint;
// fetch the page yourself and POST its HTML to /v1/html-to-pdf/sync.
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY");
var sourceHtml = await http.GetStringAsync("https://example.com");
var body = new { html = sourceHtml };
var json = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json");
var resp = await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json);
resp.EnsureSuccessStatusCode();
using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
var pdfBytes = await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString());
File.WriteAllBytes("webpage.pdf", pdfBytes);
}
}
Imports System.IO
Imports System.Net.Http
Imports System.Net.Http.Headers
Imports System.Text
Imports System.Text.Json
Imports System.Threading.Tasks
Module Program
Async Function Main() As Task
Using http As New HttpClient()
http.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY")
Dim sourceHtml As String = Await http.GetStringAsync("https://example.com")
Dim body = New With {Key .html = sourceHtml}
Dim json As New StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json")
Dim resp As HttpResponseMessage = Await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json)
resp.EnsureSuccessStatusCode()
Using doc As JsonDocument = JsonDocument.Parse(Await resp.Content.ReadAsStringAsync())
Dim pdfBytes As Byte() = Await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString())
File.WriteAllBytes("webpage.pdf", pdfBytes)
End Using
End Using
End Function
End Module
翻訳後(IronPDF):。
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://example.com");
pdf.SaveAs("webpage.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://example.com");
pdf.SaveAs("webpage.pdf");
}
}
Imports IronPdf
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://example.com")
pdf.SaveAs("webpage.pdf")
End Sub
End Class
pdforgeには専用のURL-to-PDFエンドポイントがありません — ページを自分で取得し、そのHTMLを同期エンドポイントに投稿し、返された署名付きURLから結果をダウンロードします。 IronPDFはPdfDocumentを返します。
IronPDFの主な利点は、Chromiumエンジンを使ってURLを取得し、ローカルでレンダリングすることです。 IronPDFはローカルライブラリであるため、ウェブリクエストのラウンドトリップタイムがなく、パフォーマンスが向上します。 URLからPDFへの変換の詳細については、こちらをご覧ください。
例3: カスタム設定でHTMLファイルをPDFにする
ビフォア(pdforge):。
// REST API — no .NET SDK on NuGet. Page size / orientation flow through the
// optional `pdfParams` object using Chromium/Puppeteer-style names.
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY");
var htmlContent = File.ReadAllText("input.html");
var body = new { html = htmlContent, pdfParams = new { format = "A4", landscape = true } };
var json = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json");
var resp = await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json);
resp.EnsureSuccessStatusCode();
using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
var pdfBytes = await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString());
File.WriteAllBytes("output.pdf", pdfBytes);
}
}
// REST API — no .NET SDK on NuGet. Page size / orientation flow through the
// optional `pdfParams` object using Chromium/Puppeteer-style names.
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY");
var htmlContent = File.ReadAllText("input.html");
var body = new { html = htmlContent, pdfParams = new { format = "A4", landscape = true } };
var json = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json");
var resp = await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json);
resp.EnsureSuccessStatusCode();
using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
var pdfBytes = await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString());
File.WriteAllBytes("output.pdf", pdfBytes);
}
}
Imports System.IO
Imports System.Net.Http
Imports System.Net.Http.Headers
Imports System.Text
Imports System.Text.Json
Imports System.Threading.Tasks
Module Program
Async Function Main() As Task
Using http As New HttpClient()
http.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY")
Dim htmlContent As String = File.ReadAllText("input.html")
Dim body = New With {
.html = htmlContent,
.pdfParams = New With {
.format = "A4",
.landscape = True
}
}
Dim json As New StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json")
Dim resp As HttpResponseMessage = Await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json)
resp.EnsureSuccessStatusCode()
Using doc As JsonDocument = JsonDocument.Parse(Await resp.Content.ReadAsStringAsync())
Dim pdfBytes As Byte() = Await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString())
File.WriteAllBytes("output.pdf", pdfBytes)
End Using
End Using
End Function
End Module
翻訳後(IronPDF):。
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Rendering;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
var htmlContent = System.IO.File.ReadAllText("input.html");
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Rendering;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
var htmlContent = System.IO.File.ReadAllText("input.html");
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
}
}
Imports IronPdf
Imports IronPdf.Rendering
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape
Dim htmlContent = System.IO.File.ReadAllText("input.html")
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
pdf.SaveAs("output.pdf")
End Sub
End Class
この例は、構成パターンの違いを示しています。 pdforgeはポストボディ内のpdfParamsオブジェクトのJSONフィールドとしてオプションを渡し、Chromium/Puppeteerの命名規則に従います。
IronPDFは強く型付けされた列挙型であるRenderingOptionsプロパティを使用します。 インテリセンスのサポートとコンパイル時の型安全性を提供します。 IronPDFでは、用紙サイズおよび方向の列挙型のためにIronPdf.Rendering名前空間をインポートする必要があることに注意してください。 より多くの設定例については、チュートリアルを参照してください。
重要な移行に関する注意事項
返品タイプの変更
pdforgeは署名付きURLを含むJSONエンベロープを返します; IronPDFはPdfDocumentを返します:
// pdforge: Two-step — parse signedUrl from JSON, then fetch bytes from it
var resp = await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json);
using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
var pdfBytes = await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString());
File.WriteAllBytes("output.pdf", pdfBytes);
// IronPDF: Returns PdfDocument
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf"); // Direct save
byte[] bytes = pdf.BinaryData; // Get bytes if needed
// pdforge: Two-step — parse signedUrl from JSON, then fetch bytes from it
var resp = await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json);
using var doc = JsonDocument.Parse(await resp.Content.ReadAsStringAsync());
var pdfBytes = await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString());
File.WriteAllBytes("output.pdf", pdfBytes);
// IronPDF: Returns PdfDocument
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf"); // Direct save
byte[] bytes = pdf.BinaryData; // Get bytes if needed
Imports System.IO
Imports System.Net.Http
Imports System.Text.Json
Imports IronPdf
' pdforge: Two-step — parse signedUrl from JSON, then fetch bytes from it
Dim resp = Await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json)
Using doc As JsonDocument = JsonDocument.Parse(Await resp.Content.ReadAsStringAsync())
Dim pdfBytes = Await http.GetByteArrayAsync(doc.RootElement.GetProperty("signedUrl").GetString())
File.WriteAllBytes("output.pdf", pdfBytes)
End Using
' IronPDF: Returns PdfDocument
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("output.pdf") ' Direct save
Dim bytes As Byte() = pdf.BinaryData ' Get bytes if needed
ジェネレーター変更
// pdforge: HttpClient against the REST endpoint
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY");
// IronPDF: ChromePdfRenderer
var renderer = new ChromePdfRenderer();
// pdforge: HttpClient against the REST endpoint
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY");
// IronPDF: ChromePdfRenderer
var renderer = new ChromePdfRenderer();
' pdforge: HttpClient against the REST endpoint
Using http As New HttpClient()
http.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer", "pdfnoodle_api_YOUR_KEY")
' IronPDF: ChromePdfRenderer
Dim renderer As New ChromePdfRenderer()
End Using
オペレーション変更
// pdforge operations
await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json); // HTML to PDF
// URL to PDF: fetch the page first, then POST its HTML to the same endpoint
//IronPDFmethods
renderer.RenderHtmlAsPdf(html)
renderer.RenderUrlAsPdf(url)
// pdforge operations
await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json); // HTML to PDF
// URL to PDF: fetch the page first, then POST its HTML to the same endpoint
//IronPDFmethods
renderer.RenderHtmlAsPdf(html)
renderer.RenderUrlAsPdf(url)
' pdforge operations
Await http.PostAsync("https://api.pdfnoodle.com/v1/html-to-pdf/sync", json) ' HTML to PDF
' URL to PDF: fetch the page first, then POST its HTML to the same endpoint
' IronPDF methods
renderer.RenderHtmlAsPdf(html)
renderer.RenderUrlAsPdf(url)
保存メソッドの変更
// pdforge: Two-step — fetch bytes from signed URL, then write to disk
var pdfBytes = await http.GetByteArrayAsync(signedUrl);
File.WriteAllBytes("output.pdf", pdfBytes);
// IronPDF: Built-in save method
pdf.SaveAs("output.pdf");
// pdforge: Two-step — fetch bytes from signed URL, then write to disk
var pdfBytes = await http.GetByteArrayAsync(signedUrl);
File.WriteAllBytes("output.pdf", pdfBytes);
// IronPDF: Built-in save method
pdf.SaveAs("output.pdf");
' pdforge: Two-step — fetch bytes from signed URL, then write to disk
Dim pdfBytes = Await http.GetByteArrayAsync(signedUrl)
File.WriteAllBytes("output.pdf", pdfBytes)
' IronPDF: Built-in save method
pdf.SaveAs("output.pdf")
コンフィギュレーション ロケーションの変更
pdforgeはpdfParamsのJSONフィールドとしてオプションを渡します; IronPDFはRenderingOptions:
// pdforge: JSON pdfParams object on the POST body
var body = new { html, pdfParams = new { format = "A4", landscape = true } };
// IronPDF: Properties on RenderingOptions
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
// pdforge: JSON pdfParams object on the POST body
var body = new { html, pdfParams = new { format = "A4", landscape = true } };
// IronPDF: Properties on RenderingOptions
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
' pdforge: JSON pdfParams object on the POST body
Dim body = New With {Key .html = html, Key .pdfParams = New With {Key .format = "A4", Key .landscape = True}}
' IronPDF: Properties on RenderingOptions
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape
ヘッダー/フッターのプレースホルダーの構文
pdforgeはChromiumのヘッダー/フッターテンプレート形式を継承しています — HTMLフラグメントに含まれるTextHeaderFooter / HtmlHeaderFooter内の括弧のプレースホルダーを使用します:
// pdforge: Chromium template HTML inside pdfParams.footerTemplate
// "<div>Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>"
//IronPDFplaceholders
"Page {page} of {total-pages}" // Note: hyphen in total-pages
// pdforge: Chromium template HTML inside pdfParams.footerTemplate
// "<div>Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>"
//IronPDFplaceholders
"Page {page} of {total-pages}" // Note: hyphen in total-pages
' pdforge: Chromium template HTML inside pdfParams.footerTemplate
' "<div>Page <span class=""pageNumber""></span> of <span class=""totalPages""></span></div>"
' IronPDFplaceholders
"Page {page} of {total-pages}" ' Note: hyphen in total-pages
移行後の新機能
IronPDFに移行した後は、pdfでは提供できない機能を得ることができます:
PDFマージ
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("merged.pdf");
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("merged.pdf");
Dim pdf1 = PdfDocument.FromFile("document1.pdf")
Dim pdf2 = PdfDocument.FromFile("document2.pdf")
Dim merged = PdfDocument.Merge(pdf1, pdf2)
merged.SaveAs("merged.pdf")
テキスト抽出
var pdf = PdfDocument.FromFile("document.pdf");
string allText = pdf.ExtractAllText();
var pdf = PdfDocument.FromFile("document.pdf");
string allText = pdf.ExtractAllText();
Dim pdf = PdfDocument.FromFile("document.pdf")
Dim allText As String = pdf.ExtractAllText()
ウォーターマーク
pdf.ApplyWatermark("<h2 style='color:red;'>CONFIDENTIAL</h2>");
pdf.ApplyWatermark("<h2 style='color:red;'>CONFIDENTIAL</h2>");
pdf.ApplyWatermark("<h2 style='color:red;'>CONFIDENTIAL</h2>")
パスワード保護
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SecuritySettings.UserPassword = "userpassword"
pdf.SecuritySettings.OwnerPassword = "ownerpassword"
機能比較の概要
| フィーチャー | pdforge | IronPDF |
|---|---|---|
| HTMLからPDFへ | ✓ | ✓ |
| URLからPDFへ | ✓ | ✓ |
| ページ設定 | ✓ | ✓ |
| オフライン対応 | ✗ | ✓ |
| ローカル処理 | ✗ | ✓ |
| PDFのマージ | ✗ | ✓ |
| PDFの分割 | ✗ | ✓ |
| テキストの抽出 | ✗ | ✓ |
| 透かし | ✗ | ✓ |
| フォーム入力 | ✗ | ✓ |
| デジタル署名 | ✗ | ✓ |
| パスワード保護 | ✗ | ✓ |
| 料金制限なし | ✗ | ✓ |
| 1回限りのライセンス | ✗ | ✓ |
移行チェックリスト
移行前
- コードベース内のすべてのpdforge/pdf noodleエンドポイントコールをインベントリー (
api.pdforge.com,api.pdfnoodle.com) - 使用している現在の
pdfParamsJSON設定を文書化 (ページサイズ、方向、マージン) - Chromiumスタイルのヘッダー/フッターテンプレートを識別し (
<span class="pageNumber">,<span class="totalPages">)、IronPDFのプレースホルダーに変換 ({page},{total-pages}) - IronPDFライセンス キーの保存を計画する (環境変数を推奨)
- まずはIronPDFの試用ライセンスでテストしてください
パッケージの変更
- pdforgeにはNuGet for .NET SDKがありません — 削除する競合パッケージはありません
IronPdfNuGetパッケージをインストール:dotnet add package IronPdf
コードの変更
- pdforgeコール専用で使用される
System.Net.Http/System.Text.Jsonインポートを削除 - 用紙サイズと方向の列挙型のために
using IronPdf.Rendering;を追加 - 認証済みの
ChromePdfRendererで置換 RenderHtmlAsPdf()で置換- fetch-URL-then-POSTパターンを
RenderUrlAsPdf()で置換 - 2段階ステップ
GetByteArrayAsync(signedUrl)+pdf.SaveAs()で置換 RenderingOptions.PaperSizeに移動RenderingOptions.PaperOrientationに移動PdfPaperSize.A4/PdfPaperOrientation.Landscape列挙型を使用TextHeaderFooter/HtmlHeaderFooter内のChromiumテンプレートをIronPDFプレースホルダーに変換- 每リクエストの
IronPdf.License.LicenseKeyに置換
移行後
- PDF出力の品質が期待に沿うかテスト
- オフライン操作が機能することを確認する
- 構成からAPI資格情報を削除する
- 必要に応じて新しい機能(結合、透かし、セキュリティ)を追加します

