將IronPDF授權金鑰應用於專案

This article was translated from English: Does it need improvement?
Translated
View the article in English

授權金鑰是一串長字元,末尾附有授權支援到期日。 請確保正確複製此資訊。

IRONPDF-MYLICENSE-KEY-1EF01-EXPIRES.01.JAN.2050

授權金鑰字串中的任何額外空格或字元都會導致如下錯誤:

Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPDF must be licensed for development.

應用授權金鑰的最穩定方法是在調用程式庫之前,直接在您的程式碼中進行。

// Set the license key for IronPDF before making any calls to the library.
IronPdf.License.LicenseKey = "IRONPDF-MYLICENSE-KEY-EXPIRES.01.JAN.2050";
// Set the license key for IronPDF before making any calls to the library.
IronPdf.License.LicenseKey = "IRONPDF-MYLICENSE-KEY-EXPIRES.01.JAN.2050";
' Set the license key for IronPDF before making any calls to the library.
IronPdf.License.LicenseKey = "IRONPDF-MYLICENSE-KEY-EXPIRES.01.JAN.2050"
$vbLabelText   $csharpLabel

請注意從IronPDF版本2024.1.20開始,使用者需要至少擁有免費的試用授權金鑰,才能在他們的專案中使用IronPDF程式庫。 專案中缺少授權金鑰將拋出上述LicensingException錯誤。)]}

有關更多選項,包括appsettings.json,請參閱以下如何操作頁面以獲取更多資訊:IronPDF授權金鑰

Curtis Chau
技術作家

Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。

除了開發,Curtis對物聯網(IoT)有濃厚的興趣,探索創新的方法來整合硬體和軟體。在空閒時間,他喜歡玩遊戲和建立Discord機器人,結合他對技術的熱愛與創造力。

準備開始了嗎?
Nuget 下載 20,296,129 | 版本: 2026.7 剛剛發布
Still Scrolling Icon

還在捲動嗎?

想快速獲得證明嗎? PM > Install-Package IronPdf
執行範例 看您的HTML變成PDF。