string key = config["IronPdf:LicenseKey"]; IronPdf.License.LicenseKey = key;
// Validate if (License.IsValidLicense()) { Console.WriteLine("IronPDF license successfully activated!"); var info = License.GetLicenseInfo(); Console.WriteLine($"Licensee: {info.Licensee}"); Console.WriteLine($"Expires: {info.ExpirationDate?.ToShortDateString() ?? "Perpetual"}"); } else { Console.WriteLine("Invalid license key. PDF generation will fail."); return; }
License.LicenseKey = licenseKey;
IronPdf.License.LicenseKey = Environment.GetEnvironmentVariable("IRONPDF_LICENSE"); After applying the key, you should verify that IronPDF has accepted it. Use the IsValidLicense() method: