使用 IronPrint 许可证密钥
如何获取许可证密钥
添加 IronPrint 许可证密钥后,您可以无限制地部署项目,且不会添加水印。
步骤 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.License.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
Class Program
Shared Sub Main()
' Apply the IronPrint license key at the start of your application
IronPrint.License.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 ClassImports IronPrint
Class Program
Shared Sub Main()
' Apply the IronPrint license key at the start of your application
IronPrint.License.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使用 Web.Config 或 App.Config 设置您的许可证
要使用Web.Config或App.Config将密钥全局应用于您的应用程序,请在appSettings中将以下密钥添加到您的配置文件中。
<configuration>
...
<appSettings>
<add key="IronPrint.LicenseKey" value="IRONPRINT.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
在项目上发布于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 ClassImports 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验证许可证密钥
为了确保您的许可证或试用密钥的有效性,您可以使用以下代码片段:
using IronPrint;
class ValidateLicense
{
static void Main()
{
// Validate license or trial key
bool isValid = IronPrint.License.IsValidLicense("YOUR_LICENSE_KEY");
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.IsValidLicense("YOUR_LICENSE_KEY");
Console.WriteLine(isValid ? "License key is valid." : "License key is invalid.");
}
}Imports IronPrint
Class ValidateLicense
Shared Sub Main()
' Validate license or trial key
Dim isValid As Boolean = IronPrint.License.IsValidLicense("YOUR_LICENSE_KEY")
Console.WriteLine(If(isValid, "License key is valid.", "License key is invalid."))
End Sub
End ClassImports IronPrint
Class ValidateLicense
Shared Sub Main()
' Validate license or trial key
Dim isValid As Boolean = IronPrint.License.IsValidLicense("YOUR_LICENSE_KEY")
Console.WriteLine(If(isValid, "License key is valid.", "License key is invalid."))
End Sub
End Class如果返回值为True ,则表示该键有效,您可以继续使用 IronPrint。 但是,如果返回值为False ,则表示该键无效。
步骤 4:开始您的项目
为了开始使用IronPrint,我们强烈建议您遵循我们的综合教程,了解如何开始使用IronPrint。 本教程提供详细的说明和示例,帮助您掌握 IronPrint 的基本使用方法。
有问题或需要支持?
要在实时项目中使用IronPrint,您需要一个付费或试用许可证密钥,您可以通过购买许可证获得。 试用许可证可以通过访问此链接获得。
有关代码示例、教程、许可证详情和大量文档的综合集合,请访问我们网站上的IronPrint部分。
如果您有任何疑问,请随时联系support@ironsoftware.com。
常见问题
如何获得IronPrint的许可证密钥?
您可以通过我们的许可证页面购买IronPrint许可证密钥,或注册一个免费的30天试用密钥。
如何使用C#代码应用IronPrint许可证密钥?
在您应用程序的启动中包含代码 IronPrint.License.LicenseKey = "YOUR_LICENSE_KEY";,在使用IronPrint之前,确保您的许可证已应用。
我可以使用Web.Config或App.Config应用IronPrint许可证密钥吗?
是的,要全局应用,请在您的Web.Config或App.Config文件的appSettings部分添加<add key="IronPrint.LicenseKey" value="YOUR_LICENSE_KEY" />。
如果我的许可证密钥在Web.Config中不起作用,有哪些故障排除步骤?
对于ASP.NET项目或.NET Framework版本>= 4.6.2,如果您的Web.Config中的许可证密钥未被识别,请访问“在Web.config中设置许可证密钥”故障排除文章。
如何使用.NET Core的appsettings.json文件应用IronPrint许可证密钥?
在项目的根目录中创建一个appsettings.json文件,使用键“IronPrint.LicenseKey”并将其值设置为您的许可证密钥。确保其设置为复制到输出目录。
如何验证我的IronPrint许可证密钥是否已应用?
使用IronPrint.License.IsLicensed检查许可证是否已应用。如果成功,它应该返回true。
如何验证我的IronPrint许可证密钥?
使用IronPrint.License.IsValidLicense("YOUR_LICENSE_KEY")函数验证您的许可证或试用键。如果键有效,它将返回true。
在哪里可以找到IronPrint的入门教程?
要开始使用IronPrint,请参考我们的综合[IronPrint入门教程](/csharp/print/docs/),其中包含分步说明和示例。
如果我有问题或需要IronPrint的支持,我该怎么办?
如有任何与IronPrint相关的查询或支持需求,请随时联系support@ironsoftware.com。
Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。