IRONPRINTの使用 C# プリントPDFプログラム的に(コード例チュートリアル) Curtis Chau 更新日:8月 3, 2025 Download IronPrint NuGet Download Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article role="alert"> IronPrintは、Iron Softwareの最新の.NET印刷ライブラリであり、Windows、macOS、Android、iOSなど、幅広いプラットフォームとの互換性を提供します。 IronPrintを使い始めましょう! .NETでPDFを印刷するには、迅速かつ信頼性が必要です。 大容量のドキュメントの場合、印刷タスクを手動で処理するのは面倒です。 IronPrintは、この手間を解消し、請求書、レポート、画像をスムーズに印刷し、無駄な複雑さを取り除きます。 開発者は、予測不能なプリンタの挙動や時間のかかる設定を処理することなく、印刷ワークフローを自動化できます。 ビジネスは、請求書、レポート、出荷ラベルの自動印刷に依存しています。 一部のユーザーは、ビジネス上の理由で特定のページを印刷したいと考えています。 手動印刷は、ワークフローを遅くする不要なステップとエラーを導入します。 IronPrintを統合することで、開発者はこれらの非効率性を取り除き、反復タスクを自動化し、精度を向上させます。 これにより、エンドユーザーにとってタイムリーでよくフォーマットされたドキュメントを必要とするスムーズな体験が生まれます。 IronPrintは、PDFや画像を効率的に管理する方法を提供することで印刷を簡素化します。 複雑なプリンタ設定を手動で扱う代わりに、開発者はドキュメントを最低限のセットアップでプリンタに送信できます。これにより、コアアプリケーション機能に焦点を合わせるための時間が解放され、毎回ドキュメントが正しく印刷されることが保証されます。次のステップは、.NETプロジェクトにIronPrintをセットアップすることです。 プロセスはシンプルで、統合されれば毎回一貫して信頼性のある印刷を保証します。 IronPrintの始め方 NuGetパッケージマネージャーを介したインストールプロセス IronPrintのインストールは簡単です。 NuGetパッケージマネージャーを使用して.NETプロジェクトに追加する最も簡単な方法は: Visual Studioでプロジェクトを開きます。 NuGetパッケージマネージャーに移動します。 "IronPrint"を検索します。 インストールをクリックし、残りをVisual Studioに任せます。 パッケージマネージャーコンソールを好む場合は、次のコマンドを使用します: Install-Package IronPrint インストール後、すべての依存関係が適切に復元されていることを確認してください。 .NETプロジェクトでの基本設定と構成 インストールが完了したら、IronPrintを作動させるためには最低限の設定が必要です。 最初に、アプリケーションが必要なプリンタドライバにアクセスできることを確認します。 次に、ライブラリを参照して基本的なパラメータを設定し、IronPrintを初期化します。 シンプルな実装は次のようになります: // Import the IronPrint namespace to access its functionalities. using IronPrint; // Use the Printer object to send a PDF file to the default printer. Printer.Print("sample-document.pdf"); // Import the IronPrint namespace to access its functionalities. using IronPrint; // Use the Printer object to send a PDF file to the default printer. Printer.Print("sample-document.pdf"); ' Import the IronPrint namespace to access its functionalities. Imports IronPrint ' Use the Printer object to send a PDF file to the default printer. Printer.Print("sample-document.pdf") $vbLabelText $csharpLabel この基本設定により、アプリケーションはPDFファイルをすぐにデフォルトのプリンタに送信できます。 開発者は、異なるプリンタを指定したり、印刷設定を調整したり、その必要に応じて追加の設定を統合することで、動作をカスタマイズできます。 インストールとセットアップが完了したら、次のステップは、さまざまな印刷シナリオを効率的に管理するためにIronPrintのコア機能を探ることです。 コア印刷機能 PDFのプログラム印刷 IronPrintは、PDFや画像の印刷を簡単にします。 Printメソッドは、通常の手順をスキップして、PDFファイルを直接プリンタに効率的に送ります。 これは特に、PDFファイルを迅速かつ効率的に印刷する必要がある場合に役立ちます。 シンプルな実装はこのようになります: using IronPrint; // Print a PDF document using the default settings. Printer.Print("invoice.pdf"); using IronPrint; // Print a PDF document using the default settings. Printer.Print("invoice.pdf"); Imports IronPrint ' Print a PDF document using the default settings. Printer.Print("invoice.pdf") $vbLabelText $csharpLabel 画像の印刷 画像ファイルの場合、IronPrintはPNG、JPEG、BMPなどの一般的な形式をサポートします。Printメソッドは自動的に画像を検出して処理し、印刷時に明瞭さと解像度を保持します。 using IronPrint; // Print an image file, ensuring clarity and resolution are maintained during the process. Printer.Print("logo.png"); using IronPrint; // Print an image file, ensuring clarity and resolution are maintained during the process. Printer.Print("logo.png"); Imports IronPrint ' Print an image file, ensuring clarity and resolution are maintained during the process. Printer.Print("logo.png") $vbLabelText $csharpLabel 複数の画像が単一のドキュメント内で順番に処理されます。 IronPrintはフォーマットが保持され、歪みや画質の低下を防ぎます。 これにより、複雑なレポートやPDFファイルと一緒にグラフィカルなドキュメントを印刷するのに理想的です。 サイレント印刷対印刷ダイアログ IronPrintは開発者に印刷方法の制御を提供します。 サイレント印刷はPDFドキュメントをユーザー入力なしで直接プリンタに送ります。 これはバッチ印刷を自動化し、作業の中断を減らし、ワークフローの速度を上げるアプリケーションに有用です。 複数のPDFファイルを効率的に印刷できます。 using IronPrint; // Silent printing of a PDF without requiring user input. Printer.Print("report.pdf"); using IronPrint; // Silent printing of a PDF without requiring user input. Printer.Print("report.pdf"); Imports IronPrint ' Silent printing of a PDF without requiring user input. Printer.Print("report.pdf") $vbLabelText $csharpLabel また、ユーザーが印刷前に設定を調整する必要がある場合、IronPrintはプリントダイアログをトリガーすることができます。 これによりユーザーはプリンタを選択し、ページ方向を設定し、印刷品質を調整してから印刷ジョブを確定できます。 using IronPrint; // Display a print dialog for user configuration before printing the document. Printer.ShowPrintDialog("document.pdf"); using IronPrint; // Display a print dialog for user configuration before printing the document. Printer.ShowPrintDialog("document.pdf"); Imports IronPrint ' Display a print dialog for user configuration before printing the document. Printer.ShowPrintDialog("document.pdf") $vbLabelText $csharpLabel サイレント印刷はユーザー介入が不要な自動化ワークフローに最適ですが、印刷ダイアログは必要なときにカスタマイズするのに理想的です。 両方の方法はアプリケーションのニーズに応じて柔軟性と効率を確保します。 これらの機能を活用することで、開発者は.NETアプリケーション内に自動化されたユーザーフレンドリーな印刷機能を統合し、印刷PDFドキュメントのスムーズな処理を保証します。 高度な印刷設定 用紙設定 IronPrintを使用すると、開発者はアプリケーションのニーズに合わせて用紙サイズと方向をカスタマイズできます。 これは特に非標準用紙形式での印刷や特定のレイアウトが必要なときに有用です。 現在の印刷ドキュメントオブジェクトはこれらの設定を効率的に管理できます。 用紙サイズと方向を設定するには、単にPrintSettingsクラスを初期化し、目的のプロパティを指定します: using IronPrint; // Configure paper settings such as size and orientation. PrintSettings printSettings = new PrintSettings { PaperSize = PaperSize.A4, PaperOrientation = PaperOrientation.Landscape }; // Print the document using the specified settings. Printer.Print("document.pdf", printSettings); using IronPrint; // Configure paper settings such as size and orientation. PrintSettings printSettings = new PrintSettings { PaperSize = PaperSize.A4, PaperOrientation = PaperOrientation.Landscape }; // Print the document using the specified settings. Printer.Print("document.pdf", printSettings); Imports IronPrint ' Configure paper settings such as size and orientation. Private printSettings As New PrintSettings With { .PaperSize = PaperSize.A4, .PaperOrientation = PaperOrientation.Landscape } ' Print the document using the specified settings. Printer.Print("document.pdf", printSettings) $vbLabelText $csharpLabel 印刷品質とコピー数 印刷品質をより良く制御するために、開発者はDPI(ドットパーインチ)設定を調整して、ドキュメントが適切な詳細レベルで印刷されることを保証できます。 DPI設定を高くすると明確さが向上しますが、印刷時間が長くなる可能性があります。さらに、印刷するコピー数を指定できます: using IronPrint; // Configure print settings for quality and number of copies. PrintSettings printSettings = new PrintSettings { Dpi = 300, NumberOfCopies = 2 }; // Print the document with the specified settings. Printer.Print("report.pdf", printSettings); using IronPrint; // Configure print settings for quality and number of copies. PrintSettings printSettings = new PrintSettings { Dpi = 300, NumberOfCopies = 2 }; // Print the document with the specified settings. Printer.Print("report.pdf", printSettings); Imports IronPrint ' Configure print settings for quality and number of copies. Private printSettings As New PrintSettings With { .Dpi = 300, .NumberOfCopies = 2 } ' Print the document with the specified settings. Printer.Print("report.pdf", printSettings) $vbLabelText $csharpLabel プリンタ選択 開発者は、システムのデフォルトプリンタに頼る代わりに使用するプリンタを指定できます。 これは複数のプリンタが利用可能なオフィス環境で特に役立ちます。 using IronPrint; // Specify the printer to use for printing the document. PrintSettings printSettings = new PrintSettings { PrinterName = "Your Printer Name" }; // Print the document using the specified printer. Printer.Print("invoice.pdf", printSettings); using IronPrint; // Specify the printer to use for printing the document. PrintSettings printSettings = new PrintSettings { PrinterName = "Your Printer Name" }; // Print the document using the specified printer. Printer.Print("invoice.pdf", printSettings); Imports IronPrint ' Specify the printer to use for printing the document. Private printSettings As New PrintSettings With {.PrinterName = "Your Printer Name"} ' Print the document using the specified printer. Printer.Print("invoice.pdf", printSettings) $vbLabelText $csharpLabel 余白とグレースケール印刷 カスタム余白は適切なドキュメントの整列を保証し、グレースケール印刷は色が必要でないときにインクを節約できます。 余白は正確な調整のためにミリメートル単位で定義されます。 using IronPrint; // Configure print settings for margins and grayscale printing. PrintSettings printSettings = new PrintSettings { PaperMargins = new Margins { Top = 10, Right = 10, Bottom = 10, Left = 10 }, Grayscale = true }; // Print the document using the specified settings. Printer.Print("draft.pdf", printSettings); using IronPrint; // Configure print settings for margins and grayscale printing. PrintSettings printSettings = new PrintSettings { PaperMargins = new Margins { Top = 10, Right = 10, Bottom = 10, Left = 10 }, Grayscale = true }; // Print the document using the specified settings. Printer.Print("draft.pdf", printSettings); Imports IronPrint ' Configure print settings for margins and grayscale printing. Private printSettings As New PrintSettings With { .PaperMargins = New Margins With { .Top = 10, .Right = 10, .Bottom = 10, .Left = 10 }, .Grayscale = True } ' Print the document using the specified settings. Printer.Print("draft.pdf", printSettings) $vbLabelText $csharpLabel これらの高度な印刷設定を利用することで、開発者は特定の要件に合った印刷プロセスを洗練させ、一貫性のあるプロフェッショナル品質の出力を提供できます。 プリンタ情報の取得 IronPrintは開発者がシステム上のすべての利用可能なプリンタのリストを取得できるようにします。 これは、特定のプリンタを選択してから印刷ジョブを開始する必要があるアプリケーションに役立ちます。 GetPrinterNamesメソッドは、インストールされているプリンタ名の配列を返します。 using IronPrint; // Retrieve and display the names of all available printers. var printers = Printer.GetPrinterNames(); foreach (var printer in printers) { Console.WriteLine(printer); // Outputs: OneNote (Desktop), Microsoft Print to PDF } using IronPrint; // Retrieve and display the names of all available printers. var printers = Printer.GetPrinterNames(); foreach (var printer in printers) { Console.WriteLine(printer); // Outputs: OneNote (Desktop), Microsoft Print to PDF } Imports IronPrint ' Retrieve and display the names of all available printers. Private printers = Printer.GetPrinterNames() For Each printer In printers Console.WriteLine(printer) ' Outputs: OneNote (Desktop), Microsoft Print to PDF Next printer $vbLabelText $csharpLabel この実装は利用可能なプリンタ名を取得してそれをコンソールに出力します。 開発者はこのデータを使用してドロップダウンメニューをポピュレートしたり、アプリケーション内で動的にプリンタの優先設定を割り当てたりできます。 結論 IronPrintは、PDFや画像を扱うための強力かつ柔軟なソリューションを提供することで、.NETアプリケーションにおけるプログラム印刷を革新します。 IronPrintの高度な印刷設定は、用紙サイズ、印刷品質、余白、グレースケールオプションを正確に制御することをユーザーに可能にします。 さらに、そのプリンタ情報を動的に取得する能力は、手動介入を必要とせずに異なる環境に適応するアプリケーションのユーザビリティを向上させます。 印刷関連のタスクを効率的かつ正確に管理するIronPrintを使用することで、開発者はコアアプリケーション機能の改善に集中し、シームレスな機能を提供することができます。 IronPrintは、そのフル機能を探求するための無料の試用版を開発者に提供します。 ライセンスは$liteLicenseからで、すべてのサイズの企業にとって費用対効果の高いスケーラブルなソリューションを提供します。 よくある質問 C#でプログラムによってPDFを印刷するにはどうしたら良いですか? IronPrintを使って、C#でプログラムによるPDF印刷を行うことができます。NuGetパッケージマネージャーを通じてIronPrintを.NETプロジェクトに統合することで、最小限の設定で印刷プロセスを自動化できます。 PDF印刷のために.NET印刷ライブラリを使う利点は何ですか? IronPrintのような.NET印刷ライブラリを使用することで、印刷プロセスを自動化し、手動のエラーを減らし、効率を向上させることができます。静かな印刷、印刷ダイアログオプション、高度なカスタマイズ、既存のアプリケーションへのシームレスな統合をサポートします。 PDFの静かな印刷を設定するにはどうすれば良いですか? IronPrintを使用すると、ユーザーの操作なしでプリンターに直接ドキュメントを送信する静かな印刷を有効にできます。これはC#アプリケーションでの自動バッチ印刷に最適です。 紙のサイズや方向などの印刷設定を.NETライブラリでカスタマイズできますか? はい、IronPrintは、紙のサイズ、方向、印刷品質のDPIなど、特定のアプリケーション要件に合わせた印刷設定の広範なカスタマイズを可能にします。 C#アプリケーションで利用可能なプリンターのリストを取得するにはどうすれば良いですか? IronPrintのGetPrinterNamesメソッドを使用して、あなたの環境で利用可能なプリンター名の配列を取得できます。これにより、動的なプリンター選択と設定が可能になります。 どの画像形式が.NET印刷ライブラリで印刷できますか? IronPrintは、PNG、JPEG、BMPなどのさまざまな画像形式の印刷をサポートします。Printer.Printメソッドを使用して、高品質な画像印刷を確保できます。 購入前に.NET印刷ライブラリを試す方法はありますか? はい、IronPrintは開発者向けに無料の試用版を提供しており、購入を決定する前にその機能を探ることができます。完全なライセンスは749ドルから始まります。 どのプラットフォームが.NET印刷ライブラリに対応していますか? IronPrintは、Windows、macOS、Android、iOSなど、複数のプラットフォームをサポートしており、さまざまな開発環境に適しています。 既存のアプリケーションに.NET印刷ライブラリを統合するにはどうすれば良いですか? IronPrintは、既存の.NETアプリケーションにシームレスに統合でき、PDFや画像の印刷を自動化することでワークフローの効率を向上させます。 C#での自動印刷にIronPrintを使用する利点は何ですか? IronPrintは、サイレント印刷、高度な印刷設定のカスタマイズ、簡単な統合などの機能を提供することで、C#における自動印刷を簡素化し、精度とユーザーエクスペリエンスを向上させます。 Curtis Chau 今すぐエンジニアリングチームとチャット テクニカルライター Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。 関連する記事 公開日 10月 19, 2025 IronPrintを使用したVB.NETでのPDF印刷方法 VB.NET印刷PDFチュートリアル: .NETアプリでのIronPrintによるPDF印刷の実装方法。サイレント印刷、ダイアログオプション、カスタム設定。 詳しく読む 更新日 6月 22, 2025 C#でネットワークプリンターを使って印刷する方法 この記事では、C#とIronSoftwareのIronPrintを使ってネットワークプリンターで印刷する方法を探ります。 詳しく読む 更新日 7月 28, 2025 C#でQRコードを印刷する方法 この記事では、まずC#を用いたQRコード生成ライブラリのIronQRを使ってQRコードを生成します 詳しく読む C# WindowsアプリケーションでのPDFファイルの印刷方法C# プリンターにPDFを送信...
公開日 10月 19, 2025 IronPrintを使用したVB.NETでのPDF印刷方法 VB.NET印刷PDFチュートリアル: .NETアプリでのIronPrintによるPDF印刷の実装方法。サイレント印刷、ダイアログオプション、カスタム設定。 詳しく読む
更新日 6月 22, 2025 C#でネットワークプリンターを使って印刷する方法 この記事では、C#とIronSoftwareのIronPrintを使ってネットワークプリンターで印刷する方法を探ります。 詳しく読む