使用 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 ,則表示該鍵無效。


第四步:開始你的專案

要開始使用 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 檔案,其中包含一個 key-value 對:{"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 的相容性已在功能部分說明。([ironsoftware.com](https://ironsoftware.com/csharp/print/features/?utm_source=openai))。

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 34,704 | Version: 2025.11 剛發表