使用 IronPrint 许可证密钥

This article was translated from English: Does it need improvement?
Translated
View the article in English

如何获取许可证密钥

添加 IronPrint 许可证密钥后,您可以无限制地部署项目,且不会添加水印。

您可以在这里购买许可证密钥或注册免费 30 天试用密钥


步骤 1:下载最新版本的 IronPrint

步骤 2:应用您的许可证密钥

使用代码设置您的许可证

将此代码添加到应用程序的启动过程中,在 IronPrint 被使用之前。 请务必将YOUR_LICENSE_KEY替换为您的实际 IronPrint 许可证密钥。

using IronPrint;

class Program
{
    static void Main()
    {
        // Apply the IronPrint license key at the start of your application
        IronPrint.LicenseKey = "YOUR_LICENSE_KEY";

        // Verify that the license key is applied
        if (IronPrint.License.IsLicensed)
        {
            Console.WriteLine("License is applied successfully.");
        }
        else
        {
            Console.WriteLine("Failed to apply the license.");
        }

        // Start using IronPrint features
        // Your code logic goes here
    }
}
using IronPrint;

class Program
{
    static void Main()
    {
        // Apply the IronPrint license key at the start of your application
        IronPrint.LicenseKey = "YOUR_LICENSE_KEY";

        // Verify that the license key is applied
        if (IronPrint.License.IsLicensed)
        {
            Console.WriteLine("License is applied successfully.");
        }
        else
        {
            Console.WriteLine("Failed to apply the license.");
        }

        // Start using IronPrint features
        // Your code logic goes here
    }
}
Imports IronPrint

Friend Class Program
	Shared Sub Main()
		' Apply the IronPrint license key at the start of your application
		IronPrint.LicenseKey = "YOUR_LICENSE_KEY"

		' Verify that the license key is applied
		If IronPrint.License.IsLicensed Then
			Console.WriteLine("License is applied successfully.")
		Else
			Console.WriteLine("Failed to apply the license.")
		End If

		' Start using IronPrint features
		' Your code logic goes here
	End Sub
End Class
$vbLabelText   $csharpLabel

使用 Web.Config 或 App.Config 设置您的许可证

要使用Web.Config或App.Config将密钥全局应用于您的应用程序,请在appSettings中将以下密钥添加到您的配置文件中。

<configuration>
  ...
  <appSettings>
    <add key="IronPrint.LicenseKey" value="IRONPRINT.MYLICENSE.KEY.1EF01"/>
  </appSettings>
  ...
</configuration>
<configuration>
  ...
  <appSettings>
    <add key="IronPrint.LicenseKey" value="IRONPRINT.MYLICENSE.KEY.1EF01"/>
  </appSettings>
  ...
</configuration>
XML

2024.3.6版本之前发布的 IronPrint 版本存在已知的许可问题:

  • ASP.NET项目
  • .NET Framework版本 >= 4.6.2

存储在Web.config文件中的键没有被产品拾取和使用。 请访问"在 Web.config 中设置许可证密钥"故障排除文章了解更多信息。

确保IronPrint.License.IsLicensed返回true ,以验证您的应用程序是否已正确获得许可。


使用 .NET Core appsettings.json 文件设置您的许可证密钥

要将密钥全局应用于您的 .NET Core 应用程序:

  • 在项目的根目录中添加一个名为appsettings.json的 JSON 文件。
  • 在您的 JSON 配置文件中添加一个名为"IronPrint.LicenseKey"的键。其值应为您的许可证密钥。
  • 确保文件属性包含 复制到输出目录: 始终复制

文件:appsettings.json

{
    "IronPrint.LicenseKey": "IRONPRINT.MYLICENSE.KEY.1EF01"
}

步骤 3:验证您的许可证密钥

验证已安装的许可证密钥

要验证许可证密钥是否已正确应用,您可以检查IsLicensed属性。 使用以下代码片段:

using IronPrint;

class LicenseCheck
{
    static void Main()
    {
        // Check if the license is applied
        bool isLicensed = IronPrint.License.IsLicensed;
        Console.WriteLine(isLicensed ? "License applied." : "License not applied.");
    }
}
using IronPrint;

class LicenseCheck
{
    static void Main()
    {
        // Check if the license is applied
        bool isLicensed = IronPrint.License.IsLicensed;
        Console.WriteLine(isLicensed ? "License applied." : "License not applied.");
    }
}
Imports IronPrint

Friend Class LicenseCheck
	Shared Sub Main()
		' Check if the license is applied
		Dim isLicensed As Boolean = IronPrint.License.IsLicensed
		Console.WriteLine(If(isLicensed, "License applied.", "License not applied."))
	End Sub
End Class
$vbLabelText   $csharpLabel

验证许可证密钥

为了确保您的许可证或试用密钥的有效性,您可以使用以下代码片段:

using IronPrint;

class ValidateLicense
{
    static void Main()
    {
        // Validate license or trial key
        bool isValid = IronPrint.License.IsValid;
        Console.WriteLine(isValid ? "License key is valid." : "License key is invalid.");
    }
}
using IronPrint;

class ValidateLicense
{
    static void Main()
    {
        // Validate license or trial key
        bool isValid = IronPrint.License.IsValid;
        Console.WriteLine(isValid ? "License key is valid." : "License key is invalid.");
    }
}
Imports IronPrint

Friend Class ValidateLicense
	Shared Sub Main()
		' Validate license or trial key
		Dim isValid As Boolean = IronPrint.License.IsValid
		Console.WriteLine(If(isValid, "License key is valid.", "License key is invalid."))
	End Sub
End Class
$vbLabelText   $csharpLabel

如果返回值为True ,则表示该键有效,您可以继续使用 IronPrint。 但是,如果返回值为False ,则表示该键无效。


步骤 4:开始您的项目

要开始使用 IronPrint,我们强烈建议您按照我们关于如何开始使用 IronPrint 的全面教程进行操作。 本教程提供详细的说明和示例,帮助您掌握 IronPrint 的基本使用方法。


有问题或需要支持?

要在实际项目中使用 IronPrint,您需要付费或试用许可证密钥,您可以通过购买许可证来获得该密钥。 您可以通过访问此链接获取试用许可证。

如需查看完整的代码示例、教程、许可详情和详细文档,请访问我们网站上的IronPrint部分。

如有任何疑问,请随时联系。support@ironsoftware.com

常见问题解答

如何获得我的C#打印应用程序的许可证密钥?

您可以从IronPrint许可页面购买许可证密钥,或者注册免费30天试用密钥以便上线部署项目,无任何限制。

在C#中应用许可证密钥的步骤是什么?

要在C#中应用许可证密钥,在应用程序启动时使用代码IronPrint.LicenseKey = "YOUR_LICENSE_KEY";。将"YOUR_LICENSE_KEY"替换为您的实际许可证密钥。

如何在Web.Config或App.Config中设置许可证密钥?

使用以下方式将许可证密钥添加到您的配置文件中的appSettings部分:<add key="IronPrint.LicenseKey" value="YOUR_LICENSE_KEY"/>

如果我的许可证密钥未在Web.config中应用,我该怎么办?

确保您使用的是2024.3.6之后发布的版本。如果问题仍然存在,请参阅IronPrint网站上的“在Web.config中设置许可证密钥”故障排除文章。

如何在.NET Core应用程序中应用许可证密钥?

在.NET Core应用程序中,添加一个带有键值对的appsettings.json文件:{ "IronPrint.LicenseKey": "YOUR_LICENSE_KEY" },并将其属性设置为“复制到输出目录:始终复制”。

如何验证我的IronPrint许可证密钥是否正确应用?

使用代码片段bool isLicensed = IronPrint.License.IsLicensed;检查您的许可证密钥是否正确应用。返回值为true表示成功应用。

如何验证我的IronPrint许可证密钥的有效性?

要验证您的许可证密钥,使用bool isValid = IronPrint.License.IsValid;。如果返回true,您的密钥是有效的。

在哪里可以找到开始使用IronPrint的资源?

访问IronPrint网站,获取全面的教程、代码示例和广泛的文档,帮助您开始在您的项目中使用IronPrint。

如果需要IronPrint支持,我该怎么办?

对于支持,您可以发送电子邮件至或在Iron Software网站上查看IronPrint部分,获取更多资源和文档。

IronPrint 是否兼容 .NET 10?在该环境下,其许可机制是怎样的?

是的——IronPrint 支持 .NET 10,以及 .NET 9、8、7、6 和 .NET Core 3.1+,还有 .NET Framework 4.6.2+。.NET 10 中的许可方式与之前相同:您可以通过代码设置许可证密钥(` IronPrint.LicenseKey = "YOUR_LICENSE_KEY"; `),或者使用配置文件 (appsettings.json) 将其全局应用。您可以使用 ` IsLicensed属性来验证应用程序是否成功。有关功能和与 .NET 10 的兼容性,请参阅“功能”部分。([Iron Software.com](https://Iron Software.com/csharp/print/features/?utm_source=openai))

Curtis Chau
技术作家

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

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
Nuget 下载 34,704 | Version: 2025.11 刚刚发布