
When in doubt, reach out to GemBox support – they’re surprisingly responsive and can regenerate keys or help convert license types.
Happy document generating! 📄 This guide is not official GemBox documentation. Always refer to the latest GemBox.Document Licensing page for legal terms. Gembox.document License Key
Let’s fix that. This guide cuts through the legal jargon and shows you exactly how to obtain, store, and apply your —whether you own a Developer, Site, or OEM license. 1. First, What Kind of License Key Do You Have? GemBox uses a single string (e.g., "ABCD-1234-EFGH-5678" ), but the behavior of that key depends on your purchase. Before coding, identify your license type: When in doubt, reach out to GemBox support
Console.WriteLine($"License OK. Licensed to: ComponentInfo.LicenseEntity"); Console.WriteLine($"License type: ComponentInfo.LicenseType"); Always refer to the latest GemBox
using GemBox.Document; using Microsoft.Extensions.Configuration; var config = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build();
string licenseKey = config["GemBox:LicenseKey"]; ComponentInfo.SetLicense(licenseKey); # Set on your server/container export GEMBOX_DOCUMENT_LICENSE="A1B2-C3D4-E5F6-G7H8" var key = Environment.GetEnvironmentVariable("GEMBOX_DOCUMENT_LICENSE"); ComponentInfo.SetLicense(key); ✅ Method 4: appSettings in legacy web.config <appSettings> <add key="GemBoxDocumentLicense" value="A1B2-C3D4-E5F6-G7H8"/> </appSettings> string key = ConfigurationManager.AppSettings["GemBoxDocumentLicense"]; ComponentInfo.SetLicense(key); 4. Common Licensing Mistakes & How to Fix Them | Symptom | Likely Cause | Fix | | :--- | :--- | :--- | | “Trial message” on PDF/Image export | No key set, or key is malformed | Call SetLicense before loading any document. Check for extra spaces. | | LicenseException: This license key is not valid for this deployment | Using a Developer license on a live server | Purchase a Site or OEM license. | | Exception in a web app only after some time | Calling SetLicense per request (overhead) or missing static initialization | Set key once in Application_Start or static constructor. | | Everything works locally but fails on Azure/AWS | Key not deployed via environment variable or config file | Use Environment Variables or Azure App Configuration. | 5. Verify Your License Is Active (No More Guessing) Insert this small diagnostic after setting the key:
"GemBox": "LicenseKey": "A1B2-C3D4-E5F6-G7H8"