Render WebGL Content in PDFs with IronPDF
PDFFilePrintからIronPDFへの移行は、印刷専用のPdfiumラッパーから作成、操作、印刷を単一の統一されたAPIで扱う包括的なPDFライブラリへ。NET PDFワークフローを移動します。 このガイドでは、PDF生成および操作機能を追加しながら、PrinterSettingsに置き換えるためのステップバイステップのマイグレーションパスを提供します。
なぜPDFFilePrintからIronPDFに移行するのか
PDFFilePrintを理解する
PDFFilePrintは小さなオープンソースNuGetパッケージ(MIT、Christian Andersenによる)で、PdfiumViewerとGoogleのPdfiumをラップして、既存のPDFまたはXPSファイルをプリンタードライバーに静かに送信します。 最新リリースは2020年2月10日にリリースされた1.0.3で、Windows上の.NET Framework 4.6.1+をターゲットとしています。 特定の印刷タスクには便利ですが、その機能は文書処理の一側面に限定されています。公開されたインターフェイスは本質的にapp.config / Properties.Settings.Defaultキーによって駆動されています。
重要なPDFファイル印刷の制限事項
-
印刷専用: PDFを作成、編集、マージ、または変更することはできません。
FilePrintクラスは既存のPDF/XPSファイルを消費し、それをスプーラーに渡します。 -
設定ファイル駆動のAPI: プリンタ名、用紙サイズ、コピー数、および"ファイルに印刷"モードは
app.config(Properties.Settings.Default)から読み取られ、強い型のオプションオブジェクトとして渡されません。 -
Windows + .NET Frameworkのみ:
net461にターゲットを絞り、PdfiumViewerのWin32ネイティブバイナリを取り込みます。 .NET Core / .NET 6+ TFMやLinux/macOSサポートはありません。 -
限られた印刷調整: 両面印刷、ページ範囲、向き、カラーはプリンタードライバーのデフォルトに依存しており、それらに対する一級APIはありません。
-
事実上メンテナンスされていない: 1.0.3(2020年2月)以来リリースがなく、NuGetリスティングからリンクされた公開ソースリポジトリはありません。
-
単純な例外表面: PdfiumViewer / スプーラーから失敗が一般的な例外としてバブルアップし、型付けされたエラーヒエラルキーではありません。
- PDF生成なし: PDF作成ができない — HTML、URL、または画像から印刷ページに移行するには、PDFFilePrintを別のレンダラーとペアリングする必要があります。
PDFFilePrintとIronPDFの比較
| アスペクト | PDFファイル印刷 | IronPDF |
|---|---|---|
| 主な焦点 | PDF/XPS印刷 | 包括的なPDF API |
| タイプ | Pdfium印刷ラッパー | ネイティブ.NETライブラリ + Chromiumレンダラー |
| 統合。 | new FilePrint(...).Print() + app.config |
直接PdfDocument API |
| PDF印刷 | はい | はい |
| PDFの作成。 | なし | はい(HTML、URL、画像) |
| PDF操作 | なし | はい(結合、分割、編集) |
| クロスプラットフォーム。 | Windows専用(net461) | Windows、Linux、macOS、Docker |
| エラー処理。 | PdfiumViewerからの単純な例外 | 型付きIronPdfException |
| インテリセンス | 最小(小さな表面) | フル |
| NuGetパッケージ。 | PDFFilePrint 1.0.3 (MIT, Feb 2020) |
IronPdf |
| 最後のリリース | 1.0.3(2020年2月) | アクティブなリリース |
モダンな.NET(Framework 4.6.2+および.NET 6/7/8/9/10)をターゲットとするチームにとって、IronPDFはクロスプラットフォームのサポートと活発な開発を提供し、PDFFilePrintのアーキテクチャ上の限界に対処する包括的な基盤を提供します。
始める前に
前提条件
- .NET環境: .NET Framework 4.6.2+ または .NET 6/7/8/9/10
- NuGetアクセス: NuGetパッケージをインストールする機能
- IronPDFライセンス: IronPDFからライセンスキーを取得します。
NuGetパッケージの変更
# RemovePDFファイル印刷package
dotnet remove package PDFFilePrint
# Install IronPDF
dotnet add package IronPdf
# RemovePDFファイル印刷package
dotnet remove package PDFFilePrint
# 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"
PDFFilePrintの使用法を特定する
# FindPDFファイル印刷API usages
grep -r "using PDFFilePrint\|new FilePrint" --include="*.cs" .
# Find related app.config keys
grep -r "PrinterName\|PaperName\|PrintToFile\|DefaultPrintToDirectory" \
--include="*.config" --include="*.settings" .
# FindPDFファイル印刷API usages
grep -r "using PDFFilePrint\|new FilePrint" --include="*.cs" .
# Find related app.config keys
grep -r "PrinterName\|PaperName\|PrintToFile\|DefaultPrintToDirectory" \
--include="*.config" --include="*.settings" .
完全な API リファレンス
名前空間の変更
// PDFFilePrint
using PDFFilePrint;
//IronPDF— printing flows through System.Drawing.Printing
using IronPdf;
using System.Drawing.Printing;
// PDFFilePrint
using PDFFilePrint;
//IronPDF— printing flows through System.Drawing.Printing
using IronPdf;
using System.Drawing.Printing;
Imports PDFFilePrint
Imports IronPdf
Imports System.Drawing.Printing
コア クラス マッピング
| PDFファイル印刷 | IronPDF |
|---|---|
new FilePrint(path, null) (load) |
PdfDocument.FromFile(path) |
new ChromePdfRenderer() (対応なし ― PDFFilePrintはPDFを作成できません) |
new ChromePdfRenderer() |
FilePrint |
PdfDocument |
PDF生成メソッドのマッピング
| PDFファイル印刷 | IronPDF |
|---|---|
| (利用できません) | renderer.RenderHtmlAsPdf(html) |
| (利用できません) | renderer.RenderUrlAsPdf(url) |
| (利用不可 — 印刷のみ) | pdf.SaveAs(path) |
PDFの読み込みと印刷マッピング
| PDFファイル印刷 | IronPDF |
|---|---|
new FilePrint(path, null) |
PdfDocument.FromFile(path) |
fileprint.Print() (silent, always) |
pdf.Print() (silent) / pdf.Print(true) (dialog) |
Properties.Settings.Default.PrinterName = "..." then Print() |
pdf.GetPrintDocument(new PrinterSettings { PrinterName = "..." }).Print() |
印刷設定のマッピング (app.config から PrinterSettings)
PDFFilePrint設定 (Settings.Default) |
IronPDF(System.Drawing.Printing.PrinterSettings) |
|---|---|
PrinterName |
PrinterName |
Copies |
Copies |
| (no silent flag — 常にサイレント) | pdf.Print() (silent) / pdf.Print(true) (show dialog) |
| (driver default) | FromPage, ToPage, PrintRange |
| (driver default) | DefaultPageSettings.Landscape |
| (driver default) | Duplex |
| (driver default) | Collate |
PaperName |
DefaultPageSettings.PaperSize |
PrintToFile + DefaultPrintToDirectory |
PrintToFile + PrintFileName |
PDFFilePrintにはない新しい機能
| IronPDFの特徴 | 翻訳内容 |
|---|---|
PdfDocument.Merge() |
複数のPDFを結合 |
pdf.CopyPages() |
特定のページを抜粋 |
pdf.ApplyWatermark() |
透かしの追加 |
pdf.SecuritySettings |
パスワード保護 |
pdf.ExtractAllText() |
テキストコンテンツの抽出 |
pdf.RasterizeToImageFiles() |
画像に変換 |
pdf.SignWithDigitalSignature() |
デジタル署名 |
コード移行の例
例1: HTMLからPDFへの変換
ビフォア(PDFFilePrint):。
// NuGet: Install-Package PDFFilePrint
//PDFファイル印刷is a print-only wrapper around PdfiumViewer / Pdfium.
// Its FilePrint class only consumes existing PDF/XPS files — there is
// no CreateFromHtml or document-creation method.
using System;
class Program
{
static void Main()
{
throw new NotSupportedException(
"PDFFilePrint cannot convert HTML to PDF. Render the HTML to a PDF " +
"with another library, then pass the path to new FilePrint(path, null).Print().");
}
}
// NuGet: Install-Package PDFFilePrint
//PDFファイル印刷is a print-only wrapper around PdfiumViewer / Pdfium.
// Its FilePrint class only consumes existing PDF/XPS files — there is
// no CreateFromHtml or document-creation method.
using System;
class Program
{
static void Main()
{
throw new NotSupportedException(
"PDFFilePrint cannot convert HTML to PDF. Render the HTML to a PDF " +
"with another library, then pass the path to new FilePrint(path, null).Print().");
}
}
Imports System
Class Program
Shared Sub Main()
Throw New NotSupportedException("PDFFilePrint cannot convert HTML to PDF. Render the HTML to a PDF " & _
"with another library, then pass the path to new FilePrint(path, null).Print().")
End Sub
End Class
翻訳後(IronPDF):。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string htmlContent = "<html><body><h1>Hello World</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string htmlContent = "<html><body><h1>Hello World</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim htmlContent As String = "<html><body><h1>Hello World</h1></body></html>"
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
pdf.SaveAs("output.pdf")
End Sub
End Class
ここでの基本的な違いはスコープです。 PDFFilePrintにはHTMLからPDFへのパスがありません―その公開インターフェースは既存のPDFをプリンターに渡すFilePrintクラスです。 IronPDFはレンダリングをドキュメントオブジェクトから分離します: SaveAs()で保存します。
この分離により、変換前にレンダリングオプションをレンダラーで設定し、保存前に返されたPdfDocumentを操作(透かし追加、他PDFとのマージ、セキュリティ追加)することも可能です。 その他のレンダリングオプションについては、HTML to PDF documentationを参照してください。
例2: URLからPDFへの変換
ビフォア(PDFFilePrint):。
// NuGet: Install-Package PDFFilePrint
//PDFファイル印刷cannot fetch a URL or render HTML — it only sends existing
// PDF/XPS files to a printer. URL-to-PDF requires a separate renderer.
using System;
class Program
{
static void Main()
{
throw new NotSupportedException(
"PDFFilePrint cannot convert URLs to PDF. Render the URL to a PDF with " +
"another library first, then call new FilePrint(pdfPath, null).Print().");
}
}
// NuGet: Install-Package PDFFilePrint
//PDFファイル印刷cannot fetch a URL or render HTML — it only sends existing
// PDF/XPS files to a printer. URL-to-PDF requires a separate renderer.
using System;
class Program
{
static void Main()
{
throw new NotSupportedException(
"PDFFilePrint cannot convert URLs to PDF. Render the URL to a PDF with " +
"another library first, then call new FilePrint(pdfPath, null).Print().");
}
}
Imports System
Class Program
Shared Sub Main()
Throw New NotSupportedException("PDFFilePrint cannot convert URLs to PDF. Render the URL to a PDF with " & _
"another library first, then call new FilePrint(pdfPath, null).Print().")
End Sub
End Class
翻訳後(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");
}
}
// 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");
}
}
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")
End Sub
End Class
PDFFilePrintにはURL取得機能がありません。 IronPDFは、CSS、JavaScript、およびWeb機能のレンダリング用にChromiumエンジンを活用するRenderUrlAsPdf()メソッドを使用します。 URLからPDFへの変換の詳細については、こちらをご覧ください。
例3: PDFの印刷
ビフォア(PDFFilePrint):。
// NuGet: Install-Package PDFFilePrint
using System;
using PDFFilePrint;
class Program
{
static void Main()
{
// Optional: override the configured printer / copy count at runtime.
Properties.Settings.Default.PrinterName = "Default Printer";
var fileprint = new FilePrint("document.pdf", null);
fileprint.Print();
Console.WriteLine("PDF sent to printer");
}
}
// NuGet: Install-Package PDFFilePrint
using System;
using PDFFilePrint;
class Program
{
static void Main()
{
// Optional: override the configured printer / copy count at runtime.
Properties.Settings.Default.PrinterName = "Default Printer";
var fileprint = new FilePrint("document.pdf", null);
fileprint.Print();
Console.WriteLine("PDF sent to printer");
}
}
Imports System
Imports PDFFilePrint
Module Program
Sub Main()
' Optional: override the configured printer / copy count at runtime.
Properties.Settings.[Default].PrinterName = "Default Printer"
Dim fileprint = New FilePrint("document.pdf", Nothing)
fileprint.Print()
Console.WriteLine("PDF sent to printer")
End Sub
End Module
翻訳後(IronPDF):。
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Drawing.Printing;
class Program
{
static void Main()
{
var pdf = PdfDocument.FromFile("document.pdf");
// Silent print to the default printer
pdf.Print();
// Or print to a named printer with explicit PrinterSettings:
// var settings = new PrinterSettings { PrinterName = "HP LaserJet Pro" };
// pdf.GetPrintDocument(settings).Print();
Console.WriteLine("PDF sent to printer");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Drawing.Printing;
class Program
{
static void Main()
{
var pdf = PdfDocument.FromFile("document.pdf");
// Silent print to the default printer
pdf.Print();
// Or print to a named printer with explicit PrinterSettings:
// var settings = new PrinterSettings { PrinterName = "HP LaserJet Pro" };
// pdf.GetPrintDocument(settings).Print();
Console.WriteLine("PDF sent to printer");
}
}
Imports IronPdf
Imports System
Imports System.Drawing.Printing
Module Program
Sub Main()
Dim pdf = PdfDocument.FromFile("document.pdf")
' Silent print to the default printer
pdf.Print()
' Or print to a named printer with explicit PrinterSettings:
' Dim settings As New PrinterSettings With {.PrinterName = "HP LaserJet Pro"}
' pdf.GetPrintDocument(settings).Print()
Console.WriteLine("PDF sent to printer")
End Sub
End Module
この例は、2つのライブラリのアーキテクチャの違いを示しています。 PDFFilePrintはapp.config (Properties.Settings.Default)から読み取ります。 IronPDFは静的ファクトリSystem.Drawing.Printing.PrinterSettingsを渡して明示的に制御することもできます。
主な移行の変更点
new FilePrint(path, null)→PdfDocument.FromFile(path)Properties.Settings.Default.PrinterName = "..."+Print()→pdf.GetPrintDocument(new PrinterSettings { PrinterName = "..." }).Print()- デフォルトプリンタ:
PrinterNameを空にする →pdf.Print()を呼び出す
高度な印刷設定には、IronPDFはSystem.Drawing.Printing.PrinterSettingsを使用します。 追加オプションについては、印刷ドキュメントをご覧ください。
高度な印刷設定の移行
PDFFilePrintのPrinterSettingsへの移行方法は次のとおりです:
//PDFファイル印刷approach — settings live in app.config and are read via
// Properties.Settings.Default. To override at runtime you mutate Settings.Default
// before instantiating FilePrint:
// Properties.Settings.Default.PrinterName = "HP LaserJet";
// Properties.Settings.Default.Copies = 3;
// new FilePrint("document.pdf", null).Print();
//
//IronPDFequivalent — pass a System.Drawing.Printing.PrinterSettings per call:
using IronPdf;
using System.Drawing.Printing;
var pdf = PdfDocument.FromFile("document.pdf");
var settings = new PrinterSettings
{
PrinterName = "HP LaserJet",
Copies = 3,
FromPage = 1,
ToPage = 5,
PrintRange = PrintRange.SomePages
};
pdf.GetPrintDocument(settings).Print();
//PDFファイル印刷approach — settings live in app.config and are read via
// Properties.Settings.Default. To override at runtime you mutate Settings.Default
// before instantiating FilePrint:
// Properties.Settings.Default.PrinterName = "HP LaserJet";
// Properties.Settings.Default.Copies = 3;
// new FilePrint("document.pdf", null).Print();
//
//IronPDFequivalent — pass a System.Drawing.Printing.PrinterSettings per call:
using IronPdf;
using System.Drawing.Printing;
var pdf = PdfDocument.FromFile("document.pdf");
var settings = new PrinterSettings
{
PrinterName = "HP LaserJet",
Copies = 3,
FromPage = 1,
ToPage = 5,
PrintRange = PrintRange.SomePages
};
pdf.GetPrintDocument(settings).Print();
Imports IronPdf
Imports System.Drawing.Printing
'PDFファイル印刷approach — settings live in app.config and are read via
' Properties.Settings.Default. To override at runtime you mutate Settings.Default
' before instantiating FilePrint:
' Properties.Settings.Default.PrinterName = "HP LaserJet"
' Properties.Settings.Default.Copies = 3
' new FilePrint("document.pdf", null).Print()
'
'IronPDFequivalent — pass a System.Drawing.Printing.PrinterSettings per call:
Dim pdf = PdfDocument.FromFile("document.pdf")
Dim settings As New PrinterSettings With {
.PrinterName = "HP LaserJet",
.Copies = 3,
.FromPage = 1,
.ToPage = 5,
.PrintRange = PrintRange.SomePages
}
pdf.GetPrintDocument(settings).Print()
サイレントモード
//PDFファイル印刷is always silent — there is no print-dialog code path.
//IronPDFis silent by default. Pass true explicitly to show the print dialog:
pdf.Print(); // silent
pdf.Print(true); // shows print dialog
//PDFファイル印刷is always silent — there is no print-dialog code path.
//IronPDFis silent by default. Pass true explicitly to show the print dialog:
pdf.Print(); // silent
pdf.Print(true); // shows print dialog
' PDFファイル印刷is always silent — there is no print-dialog code path.
' IronPDFis silent by default. Pass true explicitly to show the print dialog:
pdf.Print() ' silent
pdf.Print(True) ' shows print dialog
移行後の新機能
IronPDFに移行すると、PDFFilePrintでは提供できない機能が得られます:
ワンステップで作成と印刷ができます
using IronPdf;
using System.Drawing.Printing;
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Invoice #12345</h1><p>Thank you for your order.</p>");
var settings = new PrinterSettings { PrinterName = "Office Printer" };
pdf.GetPrintDocument(settings).Print();
using IronPdf;
using System.Drawing.Printing;
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Invoice #12345</h1><p>Thank you for your order.</p>");
var settings = new PrinterSettings { PrinterName = "Office Printer" };
pdf.GetPrintDocument(settings).Print();
Imports IronPdf
Imports System.Drawing.Printing
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Invoice #12345</h1><p>Thank you for your order.</p>")
Dim settings As New PrinterSettings With {.PrinterName = "Office Printer"}
pdf.GetPrintDocument(settings).Print()
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");
pdf.ApplyWatermark("<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>");
pdf.SaveAs("watermarked.pdf");
var pdf = PdfDocument.FromFile("document.pdf");
pdf.ApplyWatermark("<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>");
pdf.SaveAs("watermarked.pdf");
Dim pdf = PdfDocument.FromFile("document.pdf")
pdf.ApplyWatermark("<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>")
pdf.SaveAs("watermarked.pdf")
パスワード保護
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SaveAs("secured.pdf");
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SaveAs("secured.pdf");
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SecuritySettings.UserPassword = "userpassword"
pdf.SecuritySettings.OwnerPassword = "ownerpassword"
pdf.SaveAs("secured.pdf")
テキスト抽出
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()
重要な移行に関する注意事項
クラス パターンの変更
PDFFilePrintは、FilePrintクラスを使用します。 IronPDFは、レンダリング、ドキュメント操作、および印刷を別々のタイプに分けています。
// PDFFilePrint: load + silent print (settings come from app.config)
Properties.Settings.Default.PrinterName = "HP LaserJet";
var fileprint = new FilePrint(path, null);
fileprint.Print();
// IronPDF: PdfDocument for load/manipulate, PrinterSettings for print options
var pdf = PdfDocument.FromFile(path);
var settings = new PrinterSettings { PrinterName = "HP LaserJet" };
pdf.GetPrintDocument(settings).Print();
//IronPDFcan also create PDFs from HTML —PDFファイル印刷cannot
var renderer = new ChromePdfRenderer();
var newPdf = renderer.RenderHtmlAsPdf(html);
newPdf.SaveAs(path);
// PDFFilePrint: load + silent print (settings come from app.config)
Properties.Settings.Default.PrinterName = "HP LaserJet";
var fileprint = new FilePrint(path, null);
fileprint.Print();
// IronPDF: PdfDocument for load/manipulate, PrinterSettings for print options
var pdf = PdfDocument.FromFile(path);
var settings = new PrinterSettings { PrinterName = "HP LaserJet" };
pdf.GetPrintDocument(settings).Print();
//IronPDFcan also create PDFs from HTML —PDFファイル印刷cannot
var renderer = new ChromePdfRenderer();
var newPdf = renderer.RenderHtmlAsPdf(html);
newPdf.SaveAs(path);
' PDFFilePrint: load + silent print (settings come from app.config)
Properties.Settings.Default.PrinterName = "HP LaserJet"
Dim fileprint = New FilePrint(path, Nothing)
fileprint.Print()
' IronPDF: PdfDocument for load/manipulate, PrinterSettings for print options
Dim pdf = PdfDocument.FromFile(path)
Dim settings = New PrinterSettings With {.PrinterName = "HP LaserJet"}
pdf.GetPrintDocument(settings).Print()
' IronPDF can also create PDFs from HTML — PDFファイル印刷 cannot
Dim renderer = New ChromePdfRenderer()
Dim newPdf = renderer.RenderHtmlAsPdf(html)
newPdf.SaveAs(path)
メソッド / 設定の命名変更
//PDFファイル印刷→ IronPDF
new FilePrint(path, null) → PdfDocument.FromFile(path)
fileprint.Print() → pdf.Print() // silent default
Properties.Settings.Default.PrinterName = "X" → new PrinterSettings { PrinterName = "X" }
Properties.Settings.Default.Copies = 3 → new PrinterSettings { Copies = 3 }
Properties.Settings.Default.PaperName = "A4" → settings.DefaultPageSettings.PaperSize = ...
//PDFファイル印刷has no native HTML/URL/merge/watermark methods — these are IronPDF-only.
//PDFファイル印刷→ IronPDF
new FilePrint(path, null) → PdfDocument.FromFile(path)
fileprint.Print() → pdf.Print() // silent default
Properties.Settings.Default.PrinterName = "X" → new PrinterSettings { PrinterName = "X" }
Properties.Settings.Default.Copies = 3 → new PrinterSettings { Copies = 3 }
Properties.Settings.Default.PaperName = "A4" → settings.DefaultPageSettings.PaperSize = ...
//PDFファイル印刷has no native HTML/URL/merge/watermark methods — these are IronPDF-only.
' PDFファイル印刷→ IronPDF
Dim pdf = PdfDocument.FromFile(path)
pdf.Print() ' silent default
Dim printerSettings As New PrinterSettings With {
.PrinterName = "X",
.Copies = 3
}
settings.DefaultPageSettings.PaperSize = New PaperSize("A4", 827, 1169)
' PDFファイル印刷has no native HTML/URL/merge/watermark methods — these are IronPDF-only.
例外処理
// PDFFilePrint: failures bubble up from PdfiumViewer as plain exceptions
try {
new FilePrint(path, null).Print();
}
catch (Exception ex) {
// なし granular error type — log the message and inner exception.
}
// IronPDF: typed exception hierarchy
try {
pdf.Print();
}
catch (IronPdf.Exceptions.IronPdfException ex) {
// Granular error details
}
// PDFFilePrint: failures bubble up from PdfiumViewer as plain exceptions
try {
new FilePrint(path, null).Print();
}
catch (Exception ex) {
// なし granular error type — log the message and inner exception.
}
// IronPDF: typed exception hierarchy
try {
pdf.Print();
}
catch (IronPdf.Exceptions.IronPdfException ex) {
// Granular error details
}
Imports IronPdf.Exceptions
' PDFFilePrint: failures bubble up from PdfiumViewer as plain exceptions
Try
Dim filePrint As New FilePrint(path, Nothing)
filePrint.Print()
Catch ex As Exception
' なし granular error type — log the message and inner exception.
End Try
' IronPDF: typed exception hierarchy
Try
pdf.Print()
Catch ex As IronPdfException
' Granular error details
End Try
どちらの場合も外部実行可能ファイルはありません
両方のライブラリはNuGetパッケージとして提供されます。 バンドルまたは削除するIronPdfパッケージを介して自己完結型です。
機能比較の概要
| フィーチャー | PDFファイル印刷 | IronPDF |
|---|---|---|
| 基本的な印刷 | ✓ | ✓ |
| サイレント印刷 | ✓ (常に無音) | ✓ |
| 複数部数 | ✓ (via app.config) | ✓ |
| ページ範囲 | ドライバーのデフォルトのみ | ✓ |
| デュプレックス | ドライバーのデフォルトのみ | ✓ |
| HTMLから作成 | ✗ | ✓ |
| URLから作成 | ✗ | ✓ |
| PDFのマージ | ✗ | ✓ |
| PDFの分割 | ✗ | ✓ |
| 透かしの追加 | ✗ | ✓ |
| テキスト抽出 | ✗ | ✓ |
| パスワード保護 | ✗ | ✓ |
| デジタル署名 | ✗ | ✓ |
| クロスプラットフォーム | ✗ (Windows / net461) | ✓ |
| ネイティブ.NET API | ✓ (small surface) | ✓ |
移行チェックリスト
移行前
- 全ての
new FilePrint(...)の呼び出しサイトを見つける - 現在の
app.config設定を文書化する (PrinterName,PaperName,Copies,PrintToFile,DefaultPrintToDirectory) - 環境間で使用されているプリンタ名を識別する
- 実行時に
Properties.Settings.Defaultを変更するコードがあれば記録する 新機能の機会を特定します(HTML/URLレンダリング、マージ、透かし、セキュリティ) - IronPDFライセンスキーを取得する
パッケージの変更
PDFFilePrintNuGetパッケージを削除する:dotnet remove package PDFFilePrintIronPdfNuGetパッケージをインストールする:dotnet add package IronPdfusing IronPdf;に置き換える (必要に応じてusing System.Drawing.Printing;を追加)
コードの変更
- 起動時にライセンスキー設定を追加する
new FilePrint(path, null)をPdfDocument.FromFile(path)に置き換えます- プリンタ/コピー/用紙設定を
System.Drawing.Printing.PrinterSettingsに移動 - サイレントデフォルトプリンタ出力には
pdf.GetPrintDocument(settings).Print()を使用 - 一般的な例外を以前にキャッチしたところで
try/catch IronPdfExceptionでラップする - PDFFilePrintが提供しなかったHTML/URL/マージ/透かし機能には
PdfDocument操作APIを使用する
移行後
app.configからPDFFilePrint固有のキーを削除する- すべての対象プリンタでテスト印刷
- クロスプラットフォームのテストを行う場合、Linux印刷にはCUPSが必要です。 新しい機能(透かし、セキュリティ、結合)を必要に応じて追加します
- ドキュメントの更新

