IronPrint 开始 IronPrint 入门指南 Curtis Chau 已更新:六月 10, 2025 下载 IronPrint NuGet 下载 免费试用 法学硕士副本 法学硕士副本 将页面复制为 Markdown 格式,用于 LLMs 在 ChatGPT 中打开 向 ChatGPT 咨询此页面 在双子座打开 向 Gemini 询问此页面 在双子座打开 向 Gemini 询问此页面 打开困惑 向 Perplexity 询问有关此页面的信息 分享 在 Facebook 上分享 分享到 X(Twitter) 在 LinkedIn 上分享 复制链接 电子邮件文章 This article was translated from English: Does it need improvement? Translated View the article in English IronPrint:您的 .NET 一体化打印库 IronPrint是由 Iron Software 开发的打印库。 该库与多种环境兼容,包括 Windows、macOS、Android 和 iOS。 C#打印库 下载用于打印文档的 C# 库 支持处理 PDF、PNG、HTML、TIFF、GIF、JPEG、IMAGE、位图格式 自定义打印设置 打印前显示对话框 在 C# 中免费探索该库的功能 兼容性 IronPrint具有跨平台兼容性,支持以下平台: .NET 版本支持 C# 、 VB.NET 、 F# .NET 8、7、6、5和 Core 3.1+ .NET Framework (4.6.2+) 操作系统和环境支持 Windows (7+,Server 2016+) macOS (10+) iOS (11+) Android API 21+(v5"棒棒糖") .NET 项目类型支持 -移动端(Xamarin、MAUI 和 Avalonia) -桌面(WPF、MAUI 和 Windows Avalonia) -控制台(应用和库) 安装 IronPrint 图书馆 通过 NuGet 包管理器安装 IronPrint 包: dotnet add package IronPrint 或者,直接从IronPrint NuGet 官方网站下载。 安装完成后,您可以通过在 C# 代码顶部添加using IronPrint;来开始使用。 应用许可证密钥 接下来,通过将许可证密钥分配给License类的LicenseKey属性,将有效的许可证密钥或试用密钥应用于 IronPrint。 在导入语句之后、使用任何 IronPrint 方法之前,添加以下代码: using IronPrint; // Apply your IronPrint license key here License.LicenseKey = "your-license-key-here"; using IronPrint; // Apply your IronPrint license key here License.LicenseKey = "your-license-key-here"; Imports IronPrint ' Apply your IronPrint license key here License.LicenseKey = "your-license-key-here" $vbLabelText $csharpLabel 代码示例 打印文档 只需将文件路径传递给Print方法即可打印文档。 using IronPrint; class Program { static void Main() { // Specify the file path to be printed string filePath = "document.pdf"; // Invoke the Print method to print the document IronPrint.Print(filePath); } } using IronPrint; class Program { static void Main() { // Specify the file path to be printed string filePath = "document.pdf"; // Invoke the Print method to print the document IronPrint.Print(filePath); } } Imports IronPrint Friend Class Program Shared Sub Main() ' Specify the file path to be printed Dim filePath As String = "document.pdf" ' Invoke the Print method to print the document IronPrint.Print(filePath) End Sub End Class $vbLabelText $csharpLabel 带对话框的打印 使用ShowPrintDialog方法打印文档,该方法在打印前还会显示打印对话框。 using IronPrint; class Program { static void Main() { // Specify the file path to be printed string filePath = "document.pdf"; // Invoke the ShowPrintDialog method to prompt the dialog before printing IronPrint.ShowPrintDialog(filePath); } } using IronPrint; class Program { static void Main() { // Specify the file path to be printed string filePath = "document.pdf"; // Invoke the ShowPrintDialog method to prompt the dialog before printing IronPrint.ShowPrintDialog(filePath); } } Imports IronPrint Friend Class Program Shared Sub Main() ' Specify the file path to be printed Dim filePath As String = "document.pdf" ' Invoke the ShowPrintDialog method to prompt the dialog before printing IronPrint.ShowPrintDialog(filePath) End Sub End Class $vbLabelText $csharpLabel 自定义打印设置 要通过代码配置打印设置,请实例化PrintSettings类。 配置PrintSettings对象并将其传递给其中一个打印方法。 using IronPrint; class Program { static void Main() { // Create a PrintSettings object to configure printer settings PrintSettings settings = new PrintSettings { Copies = 2, Duplex = DuplexMode.Vertical, PageOrientation = PageOrientation.Landscape }; // Specify the file path to be printed string filePath = "document.pdf"; // Invoke the Print method with custom print settings IronPrint.Print(filePath, settings); } } using IronPrint; class Program { static void Main() { // Create a PrintSettings object to configure printer settings PrintSettings settings = new PrintSettings { Copies = 2, Duplex = DuplexMode.Vertical, PageOrientation = PageOrientation.Landscape }; // Specify the file path to be printed string filePath = "document.pdf"; // Invoke the Print method with custom print settings IronPrint.Print(filePath, settings); } } Imports IronPrint Friend Class Program Shared Sub Main() ' Create a PrintSettings object to configure printer settings Dim settings As New PrintSettings With { .Copies = 2, .Duplex = DuplexMode.Vertical, .PageOrientation = PageOrientation.Landscape } ' Specify the file path to be printed Dim filePath As String = "document.pdf" ' Invoke the Print method with custom print settings IronPrint.Print(filePath, settings) End Sub End Class $vbLabelText $csharpLabel 可用的许可和支持 IronPrint是一个付费库,但是这里也提供免费试用许可证。 有关 Iron Software 的更多信息,请访问我们的网站:https://ironsoftware.com/如需更多帮助或有任何疑问,请联系我们的团队。 Iron Software 提供的支持 如需一般支持和技术咨询,请发送电子邮件至:support@ironsoftware.com 。 Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? Nuget 下载 34,704 | Version: 2025.11 刚刚发布 免费 NuGet 下载 总下载量:34,704 查看许可证