←Select platform

SetLicense(byte[],string) Method

Summary
Sets the runtime license for LEADTOOLS and unlocks support for optional features such as LEADTOOLS Imaging, Document, and Medical capabilities. After you have obtained a runtime license and a developer key, you can call Leadtools.RasterSupport.SetLicense in your application to disable the nag message.
Syntax
C#
Objective-C
C++/CLI
Python
public static void SetLicense( 
   byte[] licenseBuffer, 
   string developerKey 
) 
+ (BOOL)setLicenseData:(NSData *)licenseData 
          developerKey:(NSString *)developerKey 
                 error:(NSError **)error 
public: 
static void SetLicense(  
   array<byte>^ licenseBuffer, 
   String^ developerKey 
)  
def SetLicense(self,licenseBuffer,developerKey): 

Parameters

licenseBuffer
Byte array containing the LEADTOOLS runtime license to set.

developerKey
Character string containing the developer key.

Remarks

You must use this method to set the runtime license for LEADTOOLS and to unlock support for any optional features that you have licensed. If you do not set a RELEASE runtime license, your application will display a nag message dialog at runtime, indicating that you have developed the application without a valid runtime license.

In order to obtain a runtime license and developer key, you must contact LEAD. For more information, refer to About LEADTOOLS Runtime Licenses.

For information about LEADTOOLS Document/Medical capabilities, contact LEAD.

To determine if support for optional features has been unlocked, use IsLocked.

NOTE: As an alternative to calling RasterSupport.SetLicense, you can specify your runtime license in the Leadtools.dll.config file. For more information, see LEADTOOLS Config License.

To set the runtime license from a disk file instead of memory buffer, use SetLicense(string licenseFile, string developerKey).

Example
C#
Java
using Leadtools; 
 
 
public void SetLicenseByteArrayExample() 
{ 
#if DEBUG 
	LicenseSupport.SetLicense(); 
#else 
	byte[] license = System.IO.File.ReadAllBytes(MY_LICENSE_FILE); 
	RasterSupport.SetLicense(license, MY_DEVELOPER_KEY); 
#endif 
	bool isLocked = RasterSupport.IsLocked(RasterSupportType.Document); 
	if (isLocked) 
		Console.WriteLine("Document support is locked"); 
	else 
		Console.WriteLine("Document support is unlocked"); 
} 
 
import java.io.File; 
import java.io.FileInputStream; 
import java.io.IOException; 
import java.io.InputStream; 
import java.nio.file.Files; 
import java.nio.file.Paths; 
 
import org.junit.*; 
import org.junit.Test; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
 
 
public void setLicenseStreamExample() throws IOException { 
   Platform.setLibPath("C:\\LEADTOOLS23\\Bin\\CDLL\\x64"); 
   Platform.loadLibrary(LTLibrary.LEADTOOLS); 
 
   String licensePath = "C:\\LEADTOOLS23\\Support\\Common\\License\\LEADTOOLS.LIC"; 
   String myDevKey = Files.readString(Paths.get(licensePath + ".KEY")); 
   InputStream licenseStream = new FileInputStream(new File(licensePath)); 
 
   RasterSupport.setLicense(licenseStream, myDevKey); 
   boolean isLocked = RasterSupport.isLocked(RasterSupportType.DOCUMENT); 
 
   assertTrue("Document support is locked.", !isLocked); 
   System.out.println("Document support is unlocked."); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.5.22
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.