使用 IRONPRINT 使用 IronPDF 在 C# 中打印 PDF 文件 Curtis Chau 更新日期:8月 20, 2025 Download IronPrint NuGet 下載 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 IronPrint 是 Iron Software 全新的 .NET 列印函式庫,提供多種平台的相容性,包括 Windows、macOS、Android 和 iOS。現在就開始使用 IronPrint! 立即開始使用 IronPrint! PDF 是最常用的檔案格式。 它是輕量級的,並由大多數作業系統支援。 PDF 檔案可以輕鬆地從一個裝置分享到另一個裝置。 由於它們在任何介面和作業系統上的顯示方式完全相同,因此提供了易讀性。 PDF 可從所有裝置存取,包括行動裝置、平板電腦等。 它們的普及要求所有 C# 開發人員都知道如何使用 C# 來列印 PDF 檔案。 因為當您需要列印發票、薪資單、訂單或檔案等文件時,可能會遇到問題。這些文件通常是 PDF 檔案格式,因此我們必須知道如何使用 C# 來列印 PDF 檔案。 在 C# 中列印 PDF 文件可以使用多種函式庫來完成。 但是,您可能會遇到的一個問題是授權費用。 這些工具大多不是免費的,或是難以使用。 不過幸運的是,您不必擔心。 我找到了用 C# 來列印 PDF 檔案的最簡單、最容易的方法。 I will use the IronPDF Library to print PDF documents. 相信我,您一定會喜歡的! 您將從本文獲得什麼? 閱讀本文後,您將能夠執行下列任務: 在 C# 中列印單一 PDF 文件使用 C# 一次列印多個 PDF 文件將 URL 轉換為 PDF,然後將其列印。 ## IronPDF:。 IronPDF 是一個 .NET 函式庫,提供我們最簡單的方式來讀取、建立、處理和[列印 PDF 檔案](pdf-home/how-to/csharp-print-pdf/)。 此程式庫可用於 C# 和 VB .NET 應用程式。 它可以輕鬆使用 ASP .NET、ASP .NET Core、MVC、Web Forms 以及 .NET 和 .NET Core 上的 Web API。 它允許使用者下載 PDF 檔案、透過電子郵件傳送檔案並將檔案儲存在雲端。 您可以使用此[連結](pdf-home)探索更多關於 IronPDF 的資訊。 讓我們開始示範。 ### 開啟 Visual Studio 開啟 Visual Studio。 如果您要在現有軟體中加入此功能,請建立新專案或開啟現有專案。 本教學使用 Console Application; 您可以根據您的軟體需求任意選擇。 項目創建。 安裝 NuGet 套件Tools > NuGet Package Manager > Package Manager Console from the Menu bar on the top of the window. NuGet 套件管理員控制台。 IronPdf NuGet Package and press Enter. ```shell :ProductInstall ``` NuGet 套件的安裝如下所示: 安裝 NuGet 套件。 ## 列印 PDF 檔案中的 C#;。 現在,讓我們考慮一個範例來說明如何使用 IronPDF Library 在 C# 中列印 PDF 檔案。 開啟 `Program.cs` 檔案。在 `Program.cs` 檔案的頂端加入以下命名空間,以使用 IronPDF: ```csharp using IronPdf; ``` 現在,在 `Main` 函式內寫入以下 [code](https://ironpdf.com/how-to/csharp-print-pdf/#install-ironpdf-for-c-print-to-pdf) 內容: ```csharp using System; // Required for Console operations class Program { static void Main() { // Load the PDF document from file using PdfDocument pdfDocument = PdfDocument.FromFile(@"D:\Sample.pdf"); // Print the loaded PDF document to the default printer pdfDocument.Print(); // Print operation success message to console Console.WriteLine("File Printed Successfully!"); Console.ReadKey(); } } ``` 讓我們了解程式碼 - 以下程式碼將 PDF 檔案載入記憶體。 "Sample.Pdf "是檔案名稱,D Drive 是我的檔案位置。 您必須寫出完整的檔案路徑以及檔案名稱。 ```csharp using PdfDocument pdfDocument = PdfDocument.FromFile(@"D:\Sample.pdf"); ``` - `Print()` 函式會使用您的預設印表機列印載入的檔案。 測試程式 Console 在 C# 中列印多個 PDF 文件; 14 PDF files
發表日期 10月 19, 2025 如何使用 IronPrint 在 VB.NET 中打印 PDF VB.NET 打印 PDF 教程:在您的 .NET 應用中實現 PDF 打印。靜默打印、對話框選項、自定義設置。 閱讀更多