How to Redact Text and Regions in PDF using C#
PDF Duo .NETからIronPDFへの移行により、.NET PDFワークフローを、最近のリリースのない、専門的な文書化されていないライブラリから、安定した、よく文書化された、積極的にメンテナンスされているソリューションに移行することができます。 このガイドは、非アクティブなコンポーネントに依存するリスクに対処しながら、PDF Duoの文書化されたAPIがカバーしていない機能にアクセスするための段階的な移行パスを提供します。
なぜPDF DuoからIronPDFへ移行するのか
PDFデュオのリスク問題
PDF Duo .NET (DuoDimension Software)は、.NET用のニッチなHTMLからPDFコンポーネントです。 それは自己完結型のDLLを求めるチームにアピールする可能性がありましたが、いくつかの特性が現在のプロダクションアプリケーションには適していないことを示しております:
-
ベンダーと出所: パブリッシャーはDuoDimension Software (duodimension.com)であり、小規模なISVであり、公開されていないロードマップとGitHubリポジトリもありません。
-
文書化の乏しさ: 1つのベンダープロダクトページ、少数のサンプルスニペット、および2010年のプレスリリース。 APIリファレンスサイトもなく、意味のあるStack Overflowの存在もありません。
-
効果的に放棄された: 最後の公開リリースはv2.4、2010年12月10日付け — 約15年間新しいバージョンはありません。
-
ドキュメント化された狭い表面領域: パブリックAPIは本質的に
SavePDF(...)です。 透かし、暗号化、署名、フォーム入力、テキスト抽出、PDF結合のネイティブAPIにはドキュメントがありません。 -
レンダリングエンジンの非公開: ベンダーの資料は、OfficeまたはAcrobatに依存しない自己完結型のコンポーネントを記述していますが、使用されているHTML/CSSエンジンについては公表していません。 CSS3、モダンJavaScript、ウェブフォント、フレックス/グリッドレイアウトは主張されていません。
- プレモダンな.NET対象: ドキュメント化されたサポートは.NET Framework 1.1から3.5まで、Windows XP / Vista / 7 / 2000 / 2003用です。.NET Framework 4.x、.NET Core、.NET 5+、Linux、またはDockerのサポートはドキュメント化されていません。
PDF DuoとIronPDFの比較
| アスペクト | PDF Duo .NET | IronPDF |
|---|---|---|
| 最後のリリース | v2.4(2010年12月) | アクティブで、定期的なリリース |
| 配布 | duodimension.comからDLLをダウンロード(NuGetなし) | NuGet IronPdf |
| ランタイムサポート | .NET Framework 1.1 – 3.5、Windowsのみ | .NET FX 4.6.2+、.NET 6/7/8/9/10、Linux、macOS、Docker |
| ドキュメンテーション | 単一のベンダー製品ページ | 包括的なドキュメント + APIリファレンス |
| サポート | 可視的にはなし | プロのサポートチーム |
| コミュニティ | 無視できるほど少ない | 41M+ NuGetダウンロード(Iron Softwareスタック) |
| レンダリング | エンジンの未公表 | モダンChromium |
| 特徴 | HTML-to-PDFのみ | HTML-to-PDF、マージ、セキュリティ、署名、OCR、フォーム、透かし |
| ライセンス | ベンダーの価格ページごとに | 商業的、永久または購読 |
モダンな.NETを使用しているチームのために、IronPDFは2010年12月に公開されたv2.4というコンポーネントの代わりに、活発な開発と包括的なドキュメントを備えた安定した基盤を提供します。
始める前に
前提条件
- .NET環境: .NET Framework 4.6.2+ または.NET Core 3.1+ / .NET 5/6/7/8/9+
- NuGetアクセス: NuGetパッケージをインストールする機能
- IronPDFライセンス: IronPDFからライセンスキーを取得します。
パッケージ / リファレンスの変更
PDF Duo .NETはNuGetを介して配布されていません。 削除は手動のステップです:
# In Visual Studio: References -> remove PDFDuo.dll (and any associated
# PDF Duo files) and delete the vendored binary from your /lib folder.
# Install IronPDF
dotnet add package IronPdf
# In Visual Studio: References -> remove PDFDuo.dll (and any associated
# PDF Duo files) and delete the vendored binary from your /lib folder.
# 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"
PDF Duo の使用法を特定する
# Find all PDF Duo references
grep -r "DuoDimension\|HtmlToPdf\b\|OpenHTML\|SavePDF" --include="*.cs" .
# Find all PDF Duo references
grep -r "DuoDimension\|HtmlToPdf\b\|OpenHTML\|SavePDF" --include="*.cs" .
APIリファレンス
ベンダーのドキュメント化されたルート名前空間はDuoDimensionです。 パブリック表面は本質的にSavePDF(...)です。 以下に示すIronPDF用のサブ名前空間はIronPDFの構造を反映しています; PDF Duo .NETはサブ名前空間をドキュメント化していません。
名前空間の変更
| PDF Duo .NET | IronPDF |
|---|---|
using DuoDimension; |
using IronPdf; |
| (ドキュメント化されたサブ名前空間はありません) | using IronPdf.Rendering; |
HTMLからPDFへの変換マッピング
| PDF Duo .NET | IronPDF |
|---|---|
new DuoDimension.HtmlToPdf() |
new ChromePdfRenderer() |
conv.OpenHTML(htmlFile); conv.SavePDF(path); |
renderer.RenderHtmlFileAsPdf(htmlFile).SaveAs(path) |
conv.OpenHTML(url); conv.SavePDF(path); |
renderer.RenderUrlAsPdf(url).SaveAs(path) |
(文字列を一時的な.htmlに書き込み、次にOpenHTML) |
renderer.RenderHtmlAsPdf(html).SaveAs(path) |
ページ構成マッピング
DuoDimension.HtmlToPdfは用紙サイズ、方向、または余白の設定オブジェクトをドキュメント化していません。 以下のIronPDFカラムには明示的なRenderingOptionsの同等物が示されています。
| PDF Duo .NET | IronPDF |
|---|---|
| (ドキュメント化されたページサイズオプションはありません) | RenderingOptions.PaperSize = PdfPaperSize.A4 |
| (ドキュメント化されたページサイズオプションはありません) | RenderingOptions.PaperSize = PdfPaperSize.Letter |
| (ドキュメント化された向きオプションはありません) | RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape |
| (ドキュメント化された余白オブジェクトはありません) | 個々のマージン特性 |
マージンのマッピング
| PDF Duo .NET | IronPDF |
|---|---|
| (ドキュメント化された余白オブジェクトはありません) | 個々のプロパティ |
| (同等のものはありません)_ | RenderingOptions.MarginTop |
| (同等のものはありません)_ | RenderingOptions.MarginRight |
| (同等のものはありません)_ | RenderingOptions.MarginBottom |
| (同等のものはありません)_ | RenderingOptions.MarginLeft |
ドキュメント操作マッピング
PDF Duo .NETはHTML-to-PDFコンバーターのみです。 ベンダーの製品ページにはDuoDimension.HtmlToPdfでのロード、バイト、またはマージAPIがドキュメント化されていません。 以下の行はPDF Duoを使用する際に隣接するライブラリで通常使用されていたものと、IronPDF呼び出しがどのようにそれを統合しているかを示しています。
| 必要 | PDF Duo .NET | IronPDF |
|---|---|---|
| 既存のPDFを読み込む | ネイティブではありません —— iTextSharp 4.xまたは類似のものとペアになります | PdfDocument.FromFile(path) |
| PDFを保存 | conv.SavePDF(path) |
pdf.SaveAs(path) |
| PDFバイトを取得 | not native | pdf.BinaryData |
| PDFのマージ | ネイティブではありません —— iTextSharp 4.xまたは類似のものとペアになります | PdfDocument.Merge(pdf1, pdf2) |
PDF Duoの文書化されたAPIにない新機能
| フィーチャー | IronPDF |
|---|---|
| ヘッダー/フッター | RenderingOptions.HtmlHeader, HtmlFooter |
| ページ数 | {total-pages}プレースホルダ |
| 透かし | pdf.ApplyWatermark(html) |
| パスワード保護 | pdf.SecuritySettings |
| フォーム入力 | pdf.Form.Fields |
| デジタル署名 | pdf.SignWithFile() |
| テキスト抽出 | pdf.ExtractAllText() |
| PDFから画像へ | pdf.RasterizeToImageFiles() |
コード移行の例
例1: HTMLからPDFへの変換
翻訳前(PDF Duo):
//PDF Duo .NETis not on NuGet — reference PDFDuo.dll from the vendor download.
using DuoDimension;
using System;
using System.IO;
class Program
{
static void Main()
{
// OpenHTML accepts a file path, URL, or stream; there is no documented
// "convert HTML string" call, so write the markup to a temp file first.
var tempHtml = Path.GetTempFileName() + ".html";
File.WriteAllText(tempHtml, "<h1>Hello World</h1><p>This is a PDF document.</p>");
var conv = new HtmlToPdf();
conv.OpenHTML(tempHtml);
conv.SavePDF("output.pdf");
Console.WriteLine("PDF created successfully!");
}
}
//PDF Duo .NETis not on NuGet — reference PDFDuo.dll from the vendor download.
using DuoDimension;
using System;
using System.IO;
class Program
{
static void Main()
{
// OpenHTML accepts a file path, URL, or stream; there is no documented
// "convert HTML string" call, so write the markup to a temp file first.
var tempHtml = Path.GetTempFileName() + ".html";
File.WriteAllText(tempHtml, "<h1>Hello World</h1><p>This is a PDF document.</p>");
var conv = new HtmlToPdf();
conv.OpenHTML(tempHtml);
conv.SavePDF("output.pdf");
Console.WriteLine("PDF created successfully!");
}
}
Imports DuoDimension
Imports System
Imports System.IO
Module Program
Sub Main()
' OpenHTML accepts a file path, URL, or stream; there is no documented
' "convert HTML string" call, so write the markup to a temp file first.
Dim tempHtml As String = Path.GetTempFileName() & ".html"
File.WriteAllText(tempHtml, "<h1>Hello World</h1><p>This is a PDF document.</p>")
Dim conv As New HtmlToPdf()
conv.OpenHTML(tempHtml)
conv.SavePDF("output.pdf")
Console.WriteLine("PDF created successfully!")
End Sub
End Module
翻訳後(IronPDF):。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var htmlContent = "<h1>Hello World</h1><p>This is a PDF document.</p>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully!");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var htmlContent = "<h1>Hello World</h1><p>This is a PDF document.</p>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully!");
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim htmlContent = "<h1>Hello World</h1><p>This is a PDF document.</p>"
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
pdf.SaveAs("output.pdf")
Console.WriteLine("PDF created successfully!")
End Sub
End Class
ここでの基本的な違いは、APIパターンです。 PDF DuoのSavePDF(path)を呼び出してディスクに書き込みます。 IronPDFのSaveAs()で保存します。
このオブジェクト指向アプローチにより、PDFを操作できる柔軟性が追加されます(透かしを追加、ドキュメントをマージ、セキュリティを追加、テキストを抽出)——これらはPDF Duo .NETの文書化されたAPIの一部ではありません。 その他のレンダリングオプションについては、HTML to PDF documentationを参照してください。
例2: URLからPDFへの変換
翻訳前(PDF Duo):
//PDF Duo .NETis not on NuGet — reference PDFDuo.dll from the vendor download.
using DuoDimension;
using System;
class Program
{
static void Main()
{
var conv = new HtmlToPdf();
conv.OpenHTML("https://www.example.com");
conv.SavePDF("webpage.pdf");
Console.WriteLine("Webpage converted to PDF!");
}
}
//PDF Duo .NETis not on NuGet — reference PDFDuo.dll from the vendor download.
using DuoDimension;
using System;
class Program
{
static void Main()
{
var conv = new HtmlToPdf();
conv.OpenHTML("https://www.example.com");
conv.SavePDF("webpage.pdf");
Console.WriteLine("Webpage converted to PDF!");
}
}
Imports DuoDimension
Imports System
Module Program
Sub Main()
Dim conv As New HtmlToPdf()
conv.OpenHTML("https://www.example.com")
conv.SavePDF("webpage.pdf")
Console.WriteLine("Webpage converted to PDF!")
End Sub
End Module
翻訳後(IronPDF):。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
pdf.SaveAs("webpage.pdf");
Console.WriteLine("Webpage converted to PDF!");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
pdf.SaveAs("webpage.pdf");
Console.WriteLine("Webpage converted to PDF!");
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://www.example.com")
pdf.SaveAs("webpage.pdf")
Console.WriteLine("Webpage converted to PDF!")
End Sub
End Class
PDF Duoは、URL変換のために同じSavePDF(path)を実行します。 IronPDFは専用のPdfDocumentオブジェクトを返します。
重要な利点は、IronPDFのChromiumベースのレンダリングエンジンがモダンなCSS3とJavaScriptのサポートを提供することで、PDF Duoのベンダー資料はどのHTML/CSSエンジンが使用されているか公表していません。 URLからPDFへの変換の詳細については、こちらをご覧ください。
例 3: PDF のマージ
翻訳前(PDF Duo):
PDF Duo .NETはネイティブのPDFマージAPIを提供しません。 ドキュメント化された表面はHTML-to-PDFのみにとどまり、マージが必要であったチームは通常PDF Duoで各PDFをレンダリングし、それから別のライブラリでそれらを連結しました(2010年代のプロジェクトにはiTextSharp 4.xが一般的)。
//PDF Duo .NETis not on NuGet — reference PDFDuo.dll from the vendor download.
using DuoDimension;
using System;
class Program
{
static void Main()
{
// Render each source HTML to its own PDF
var conv = new HtmlToPdf();
conv.OpenHTML("page1.html");
conv.SavePDF("document1.pdf");
conv = new HtmlToPdf();
conv.OpenHTML("page2.html");
conv.SavePDF("document2.pdf");
// Merging into a single PDF requires another library (e.g., iTextSharp).
Console.WriteLine("PDF Duo has no native merge — combine output with another library.");
}
}
//PDF Duo .NETis not on NuGet — reference PDFDuo.dll from the vendor download.
using DuoDimension;
using System;
class Program
{
static void Main()
{
// Render each source HTML to its own PDF
var conv = new HtmlToPdf();
conv.OpenHTML("page1.html");
conv.SavePDF("document1.pdf");
conv = new HtmlToPdf();
conv.OpenHTML("page2.html");
conv.SavePDF("document2.pdf");
// Merging into a single PDF requires another library (e.g., iTextSharp).
Console.WriteLine("PDF Duo has no native merge — combine output with another library.");
}
}
Imports DuoDimension
Imports System
Module Program
Sub Main()
' Render each source HTML to its own PDF
Dim conv As New HtmlToPdf()
conv.OpenHTML("page1.html")
conv.SavePDF("document1.pdf")
conv = New HtmlToPdf()
conv.OpenHTML("page2.html")
conv.SavePDF("document2.pdf")
' Merging into a single PDF requires another library (e.g., iTextSharp).
Console.WriteLine("PDF Duo has no native merge — combine output with another library.")
End Sub
End Module
翻訳後(IronPDF):。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("merged.pdf");
Console.WriteLine("PDFs merged successfully!");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("merged.pdf");
Console.WriteLine("PDFs merged successfully!");
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim pdf1 = PdfDocument.FromFile("document1.pdf")
Dim pdf2 = PdfDocument.FromFile("document2.pdf")
Dim merged = PdfDocument.Merge(pdf1, pdf2)
merged.SaveAs("merged.pdf")
Console.WriteLine("PDFs merged successfully!")
End Sub
End Class
この例は、基本的なアーキテクチャの違いを示しています。 PDF Duo .NETにはマージAPIは全くありません — PDF Duoのワークフローでのマージは典型的には、iTextSharp 4.xのような第2のライブラリとペアを組むことを意味しました。
IronPDFはこれを単一の依存関係に統合します。PdfDocument.Merge()メソッドを使用します。 これは、PdfDocumentオブジェクトを返します。
IronPDFのアプローチでは、マージ前にPDFを任意に操作し、マージ結果に透かしを追加し、セキュリティ設定を適用するなどの操作が可能です。 多数のファイルをマージするには、LINQを使用できます:
var paths = new[] { "document1.pdf", "document2.pdf", "document3.pdf" };
var pdfs = paths.Select(PdfDocument.FromFile).ToList();
var merged = PdfDocument.Merge(pdfs);
merged.SaveAs("merged.pdf");
var paths = new[] { "document1.pdf", "document2.pdf", "document3.pdf" };
var pdfs = paths.Select(PdfDocument.FromFile).ToList();
var merged = PdfDocument.Merge(pdfs);
merged.SaveAs("merged.pdf");
Dim paths = {"document1.pdf", "document2.pdf", "document3.pdf"}
Dim pdfs = paths.Select(AddressOf PdfDocument.FromFile).ToList()
Dim merged = PdfDocument.Merge(pdfs)
merged.SaveAs("merged.pdf")
PDFのマージと分割については、こちらをご覧ください。
移行後の新機能
IronPDFに移行した後は、PDF Duoでは提供できない機能を得ることができます:
ページ番号を含むヘッダーとフッター
using IronPdf;
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter
{
HtmlFragment = "<div style='text-align:center; font-size:10px;'>Company Report</div>",
MaxHeight = 25
};
renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter
{
HtmlFragment = "<div style='text-align:center; font-size:10px;'>Page {page} of {total-pages}</div>",
MaxHeight = 25
};
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("report.pdf");
using IronPdf;
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter
{
HtmlFragment = "<div style='text-align:center; font-size:10px;'>Company Report</div>",
MaxHeight = 25
};
renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter
{
HtmlFragment = "<div style='text-align:center; font-size:10px;'>Page {page} of {total-pages}</div>",
MaxHeight = 25
};
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("report.pdf");
Imports IronPdf
Dim renderer As New ChromePdfRenderer()
renderer.RenderingOptions.HtmlHeader = New HtmlHeaderFooter With {
.HtmlFragment = "<div style='text-align:center; font-size:10px;'>Company Report</div>",
.MaxHeight = 25
}
renderer.RenderingOptions.HtmlFooter = New HtmlHeaderFooter With {
.HtmlFragment = "<div style='text-align:center; font-size:10px;'>Page {page} of {total-pages}</div>",
.MaxHeight = 25
}
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("report.pdf")
PDF Duoはヘッダーやフッターに対応しておらず、同等の機能はありません。 IronPDFはHTML/CSSをフルサポートし、ページ番号のような動的コンテンツ用のプレースホルダーを内蔵しています。 ヘッダーとフッターガイドを参照してください。
ウォーターマーク
using IronPdf;
using IronPdf.Editing;
var pdf = PdfDocument.FromFile("document.pdf");
pdf.ApplyWatermark(
"<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>",
45,
VerticalAlignment.Middle,
HorizontalAlignment.Center);
pdf.SaveAs("watermarked.pdf");
using IronPdf;
using IronPdf.Editing;
var pdf = PdfDocument.FromFile("document.pdf");
pdf.ApplyWatermark(
"<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>",
45,
VerticalAlignment.Middle,
HorizontalAlignment.Center);
pdf.SaveAs("watermarked.pdf");
Imports IronPdf
Imports IronPdf.Editing
Dim pdf = PdfDocument.FromFile("document.pdf")
pdf.ApplyWatermark("<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>", 45, VerticalAlignment.Middle, HorizontalAlignment.Center)
pdf.SaveAs("watermarked.pdf")
PDF Duoは透かしに対応していません。 IronPDFはHTMLベースの透かしを提供し、完全なCSSスタイリングをサポートします。
パスワード保護
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights;
pdf.SaveAs("secured.pdf");
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights;
pdf.SaveAs("secured.pdf");
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SecuritySettings.UserPassword = "userpassword"
pdf.SecuritySettings.OwnerPassword = "ownerpassword"
pdf.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights
pdf.SaveAs("secured.pdf")
PDF Duoはパスワード保護やセキュリティ設定に対応していません。
テキスト抽出
var pdf = PdfDocument.FromFile("document.pdf");
string text = pdf.ExtractAllText();
var pdf = PdfDocument.FromFile("document.pdf");
string text = pdf.ExtractAllText();
Dim pdf = PdfDocument.FromFile("document.pdf")
Dim text As String = pdf.ExtractAllText()
PDF Duoはテキスト抽出に対応していません。
重要な移行に関する注意事項
PDF DuoのHtmlToPdfにページレイアウトオプションなし
DuoDimension.HtmlToPdfは用紙サイズ、方向、または余白をカバーする設定オブジェクトをドキュメント化していません。 IronPDFはこれらをRenderingOptionsで明示的に公開します。
// PDF Duo: no documented per-instance settings — OpenHTML / SavePDF only.
// IronPDF:
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
renderer.RenderingOptions.MarginTop = 20;
renderer.RenderingOptions.MarginRight = 15;
renderer.RenderingOptions.MarginBottom = 20;
renderer.RenderingOptions.MarginLeft = 15;
// PDF Duo: no documented per-instance settings — OpenHTML / SavePDF only.
// IronPDF:
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
renderer.RenderingOptions.MarginTop = 20;
renderer.RenderingOptions.MarginRight = 15;
renderer.RenderingOptions.MarginBottom = 20;
renderer.RenderingOptions.MarginLeft = 15;
' PDF Duo: no documented per-instance settings — OpenHTML / SavePDF only.
' IronPDF:
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4
renderer.RenderingOptions.MarginTop = 20
renderer.RenderingOptions.MarginRight = 15
renderer.RenderingOptions.MarginBottom = 20
renderer.RenderingOptions.MarginLeft = 15
セーブメソッドの命名
ファイルを書き込むための異なるメソッド名:
// PDF Duo:
conv.SavePDF("output.pdf");
// IronPDF:
pdf.SaveAs("output.pdf");
// PDF Duo:
conv.SavePDF("output.pdf");
// IronPDF:
pdf.SaveAs("output.pdf");
' PDF Duo:
conv.SavePDF("output.pdf")
' IronPDF:
pdf.SaveAs("output.pdf")
既存のPDFをロードする
PDF Duo .NETはPDFを書くのみです —"既存のPDFをロードする"呼び出しはドキュメント化されていません。 既存のPDFを操作するにはIronPDF(または他のライブラリ)に移行する必要があります:
// PDF Duo: no equivalent.
// IronPDF:
var pdf = PdfDocument.FromFile("document.pdf");
// PDF Duo: no equivalent.
// IronPDF:
var pdf = PdfDocument.FromFile("document.pdf");
Imports IronPdf
Dim pdf = PdfDocument.FromFile("document.pdf")
HTML文字列入力
PDF DuoのOpenHTMLは"このHTML文字列をレンダリングする"機能の呼び出しをドキュメント化していません。 チームはまずマークアップを一時ファイルに書きます。IronPDFは文字列を直接レンダリングします:
// PDF Duo:
File.WriteAllText("temp.html", html);
var conv = new DuoDimension.HtmlToPdf();
conv.OpenHTML("temp.html");
conv.SavePDF("output.pdf");
// IronPDF:
var renderer = new ChromePdfRenderer();
renderer.RenderHtmlAsPdf(html).SaveAs("output.pdf");
// PDF Duo:
File.WriteAllText("temp.html", html);
var conv = new DuoDimension.HtmlToPdf();
conv.OpenHTML("temp.html");
conv.SavePDF("output.pdf");
// IronPDF:
var renderer = new ChromePdfRenderer();
renderer.RenderHtmlAsPdf(html).SaveAs("output.pdf");
' PDF Duo:
File.WriteAllText("temp.html", html)
Dim conv = New DuoDimension.HtmlToPdf()
conv.OpenHTML("temp.html")
conv.SavePDF("output.pdf")
' IronPDF:
Dim renderer = New ChromePdfRenderer()
renderer.RenderHtmlAsPdf(html).SaveAs("output.pdf")
機能比較
| フィーチャー | PDF Duo .NET | IronPDF |
|---|---|---|
| HTMLからPDFへ | はい(エンジン非公開) | 完全なCSS3、JavaScript |
| URLからPDFへ | はい | 認証サポート付き |
| PDFマージ | ドキュメント化されたAPIにはありません | はい |
| ヘッダー/フッター | ドキュメント化されたAPIにはありません | HTMLフルサポート |
| ページ数 | ドキュメント化されたAPIにはありません | 組み込みプレースホルダ |
| 透かし | ドキュメント化されたAPIにはありません | HTMLベース |
| パスワード保護 | ドキュメント化されたAPIにはありません | 完全なセキュリティオプション |
| フォーム入力 | ドキュメント化されたAPIにはありません | はい |
| デジタル署名 | ドキュメント化されたAPIにはありません | はい |
| テキスト抽出 | ドキュメント化されたAPIにはありません | はい |
| PDFから画像へ | ドキュメント化されたAPIにはありません | はい |
| 非同期サポート | ドキュメント化されたAPIにはありません | 完全なasync/await |
| .NET Core/5+ | ドキュメント化されたランタイムリストにはありません | サポート対象 |
移行チェックリスト
移行前
- コードベース内のすべての PDF Duo 参照を検索
- 現在の設定(ページ サイズ、余白など)を文書化します
- 使用されたすべてのPDF操作を一覧表示します
- 新しい機能(ヘッダー、透かし、セキュリティ)の機会を特定する
- IronPDFライセンスキーを取得する
パッケージの変更
- プロジェクトの参照から
PDFDuo.dllを削除します(PDF Duo .NETはNuGetにはありません)。ベンダーのバイナリを削除します。 IronPdfNuGetパッケージをインストールします:dotnet add package IronPdf- 名前空間のインポートを
using IronPdf;に更新します。
コードの変更
- 起動時にライセンスキー設定を追加する
ChromePdfRendererに置き換えます。RenderHtmlFileAsPdf(path).SaveAs(path)に置き換えます。- HTML文字列のための一時ファイル回避を
RenderHtmlAsPdf(html).SaveAs(path)に置き換えます。 RenderUrlAsPdf(url).SaveAs(path)に置き換えます。- 外部マージステップをすべて
PdfDocument.Merge()に置き換えます。 - ページサイズと余白を
RenderingOptionsで明示的に設定します(PDF Duoの同等物はありません)。 SaveAs()に置き換えます。- "既存のPDFを読み込む"ワークフローには
PdfDocument.FromFile()を使用します(PDF Duoの同等物はありません)。
移行後
- PDF出力を比較する回帰テストを実行する
- ページサイズと余白が一致していることを確認する
- 複雑な HTML/CSS でテストする (IronPDF の最新エンジンの方がより適切に処理できるはずです)
- 新しい機能の追加(ヘッダー、フッター、透かし、セキュリティ)
- ドキュメントの更新

