使用IronPrint許可證密鑰
如何取得許可證密鑰
新增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
使用 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>
在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"的鍵。其值應為您的許可證密鑰。
- 確保檔案屬性包含 複製到輸出目錄: 始終複製。
文件: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
驗證許可證密鑰
為確保您的許可證或試用金鑰的有效性,您可以使用以下程式碼片段:
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
如果傳回值為True ,則表示該鍵有效,您可以繼續使用IronPrint。 但是,如果傳回值為False ,則表示該鍵無效。
第四步:開始你的專案
要開始使用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 中。
如果我的許可證密鑰沒有在 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 的支持,我應該怎麼做?
如需支持,您可以發送電子郵件至
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 的兼容性,請參閱「功能」部分。 ([ironsoftware.com](https://ironsoftware.com/csharp/print/features/?utm_source=openai))

