使用 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.Co/nfig 或 App.Co/nfig 設定您的授權

若要透過 Web.Co/nfig 或 App.Co/nfig 在應用程式中全域套用某個金鑰,請在設定檔的 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.co/nfig 檔案中的金鑰並未被產品讀取及使用。 請參閱"在 Web.co/nfig 中設定授權金鑰"的疑難排解文章以了解更多資訊。

請確保 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/support@ironsoftware.com

常見問題

我該如何取得 C# PRINT 應用程式的授權金鑰?

您可從 IronPrint 授權頁面購買授權金鑰,或註冊免費 30天試用金鑰,以無限制地將您的專案部署至正式環境。

在 C# 中套用授權金鑰的步驟為何?

要在 C# 中套用授權金鑰,請在 IronPrint.LicenseKey = "YOUR_LICENSE_KEY"; 。請將 "YOUR_LICENSE_KEY" 替換為您的實際授權金鑰。

如何在 Web.Co/nfig 或 App.Co/nfig 中設定授權金鑰?

請將您的授權金鑰加入 appSettings 配置檔案的區段中,使用: <add key="IronPrint.LicenseKey" value="YOUR_LICENSE_KEY"/>.

如果我的授權金鑰無法在 Web.co/nfig 中生效,該怎麼辦?

請確認您使用的是 2024.3.6 之後發佈的版本。若問題仍未解決,請參閱 IronPrint 網站上的「在 Web.co/nfig 中設定授權金鑰」疑難排解文章。

如何在 .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
技術撰稿人

Curtis Chau 擁有卡爾頓大學(Carleton University)的電腦科學學士學位,專精於前端開發,並精通 Node.js、TypeScript、JavaScript 及 React。他熱衷於打造直觀且美觀的用戶介面,喜歡運用現代框架,並創建結構完善、視覺上吸引人的手冊。

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

準備開始了嗎?
Nuget 下載 41,154 | 版本: 2026.5 just released
Still Scrolling Icon

還在往下捲動嗎?

想要快速確認成果嗎? PM > Install-Package IronPrint
執行範例程式,親眼見證您的文件送印。