使用 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
    }
}
$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.");
    }
}
$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.");
    }
}
$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文件,其中包含一個鍵值對: { "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擁有卡爾頓大學電腦科學學士學位,專長於前端開發,精通Node.js、TypeScript、JavaScript和React。他熱衷於打造直覺美觀的使用者介面,喜歡使用現代框架,並擅長撰寫結構清晰、視覺效果出色的使用者手冊。

除了開發工作之外,柯蒂斯對物聯網 (IoT) 也抱有濃厚的興趣,致力於探索硬體和軟體整合的創新方法。閒暇時,他喜歡玩遊戲和製作 Discord 機器人,將他對科技的熱愛與創造力結合。

準備好開始了嗎?
Nuget 下載 36,035 | 版本: 2025.12 剛剛發布