LEADTOOLS Support
General
General FAQ
FAQ: How do I set my license in HTML5/JS?
#1
Posted
:
Tuesday, March 6, 2018 12:06:58 PM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
An updated tutorial for setting a JavaScript license can be found here:
https://www.leadtools.co...s-and-set-a-license.htmlLEADTOOLS v19 and EarlierThe LEADTOOLS HTML5/JS files use a license file like the other binaries we provide in order to unlock LEADTOOLS features. With LEADTOOLS 18 and LEADTOOLS 19, the Leadtools.js by default would look for the LeadtoolsLicense.txt file in a LEADTOOLS directory from the root of the application folder. The directory location could be changed by setting
lt.LTHelper.licenseDirectory, but the name of the file still has to be LeadtoolsLicense.txt. There also isn't any way to reference the text file from another machine. It has to reside in a directory accessible by the web server hosting the application.
LEADTOOLS v20+With LEADTOOLS 20 and beyond, the license can now be set using
RasterSupport.setLicenseUri(). This method will allow developers to not only set a license file from a common location (as might be needed with cloud applications), but it also will let developers specify the name of the file since the file will be downloaded by the browser. This method also includes a callback so if you wanted to run additional code after the license check has occurred you can do so.
Here is some sample code illustrating setLicenseUri:
Code:
if (lt.RasterSupport.kernelExpired) {
lt.RasterSupport.setLicenseUri("http://localhost/SetLicenseTest/data/myLic.txt", function() {
if (!lt.RasterSupport.kernelExpired)
lt.LTHelper.log("LEADTOOLS client license set successfully");
else
lt.LTHelper.log("LEADTOOLS client license not set");
});
}
Note that the web server where the license file is hosted must support the MIME type being requested.
To set the license directly, use lt.RasterSupport.setLicenseText(). The value to pass in for this is the actual contents of the leadtoolslicense.txt file. Note no callback is available when setting the license in this manner.
https://www.leadtools.com/help/leadtools/v20/dh/javascript/l/rastersupport-setlicensetext.htmlEdited by moderator Wednesday, December 27, 2023 1:16:18 PM(UTC)
| Reason: Updating layout, adding more information
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
General
General FAQ
FAQ: How do I set my license in HTML5/JS?
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.