IRONSOFTWAREHOME

IronPrint 入门指南

Curtis Chau
Curtis Chau
Updated: 2026年4月22日

IronPrint:您的 .NET 一体化打印库

IronPrint是由 Iron Software 开发的打印库。 该库与多种环境兼容,包括 Windows、macOS、Android 和 iOS。

兼容性

IronPrint具有跨平台兼容性,支持以下平台:

.NET 版本支持

  • C#VB.NETF#
  • .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;来开始。

应用许可证密钥

接下来,通过将许可证密钥分配给LicenseKey属性,应用一个有效许可证或试用密钥给IronPrint。 在导入语句之后、使用任何 IronPrint 方法之前,添加以下代码:

using IronPrint;

// Apply your IronPrint license key here
License.LicenseKey = "your-license-key-here";

代码示例

打印文档

只需将文件路径传递给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);
    }
}

带对话框的打印

使用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);
    }
}

自定义打印设置

要从代码中配置打印设置,请实例化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);
    }
}

可用的许可和支持

IronPrint 是一个付费库; 然而,这里也提供免费试用许可证。

有关 Iron Software 的更多信息,请访问我们的网站:https://ironsoftware.com/如需更多帮助或有任何疑问,请联系我们的团队

Iron Software 提供的支持

如需一般支持和技术咨询,请发送电子邮件至:support@ironsoftware.com

Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

...
阅读更多

准备开始了吗?

Nuget Downloads 46,090版本:2026.9刚刚发布

立即获取您的免费30 天试用密钥
无需信用卡或创建账户
C# 用于 PDF 的 NuGet 库
通过 NuGet 安装

版本: 2026.9

PM > Install-Package IronPrint
nuget.org/packages/IronPrint/
  1. 在解决方案资源管理器中,右键点击引用,管理 NuGet 包
  2. 选择“浏览”并搜索“IronPrint”
  3. 选择包并安装
C# PDF DLL
下载 DLL

版本: 2026.9

  1. 下载并解压 IronPrint 到您的解决方案目录中的 ~/Libs 之类的位置
  2. 在 Visual Studio 解决方案资源管理器中,右键单击引用。选择“浏览”,“IronPrint.dll”

$999 起售

Key in blue circle

立即获取免费的 30 天试用版密钥

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
预约您的免费现场演示
Booking Badge

深受全球数百万工程师信赖

Iron Software 的客户徽标
获取您的无义务咨询
填写下面的表格或通过sales@ironsoftware.com
您的资料将始终保密。
深受全球数百万工程师信赖
Iron Software 的客户徽标
立即获取您的免费30 天试用密钥
无需信用卡或创建账户