|
| 1 | +--- |
| 2 | +layout: default-layout |
| 3 | +title: License initialization - Dynamsoft Document Normalizer |
| 4 | +description: This is the documentation - License initialization page of Dynamsoft Document Normalizer. |
| 5 | +keywords: Document Normalizer, License initialization |
| 6 | +needAutoGenerateSidebar: true |
| 7 | +breadcrumbText: License Initialization |
| 8 | +--- |
| 9 | + |
| 10 | +# License initialization |
| 11 | + |
| 12 | +## Get a trial key |
| 13 | + |
| 14 | +- A free public trial license is available for every new device for first use of Dynamsoft Document Normalizer. The public trial license is the default key used in samples. You can also find the public trial license on the following parts of this page. |
| 15 | +- If your free key is expired, please visit <a href="https://www.dynamsoft.com/customer/license/trialLicense?product=ddn&utm_source=docs" target="_blank">Private Trial License Page</a> to get a 30-day trial extension. |
| 16 | + |
| 17 | +## Get a full license |
| 18 | + |
| 19 | +- [Contact us](https://www.dynamsoft.com/company/contact/) to purchase a full license |
| 20 | + |
| 21 | +## Initialize the license |
| 22 | + |
| 23 | +The following code snippets are using the public trial license to initialize the license. You can replace the public trial license with your own license key. |
| 24 | + |
| 25 | +<div class="sample-code-prefix"></div> |
| 26 | +>- JavaScript |
| 27 | +>- Java-Android |
| 28 | +>- Objective-C |
| 29 | +>- Swift |
| 30 | +>- C |
| 31 | +>- C++ |
| 32 | +> |
| 33 | +>1. |
| 34 | +```javascript |
| 35 | +Dynamsoft.DDN.DocumentNormalizer.license = "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9"; |
| 36 | +``` |
| 37 | +2. |
| 38 | +```java |
| 39 | +LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", MainActivity.this, new LicenseVerificationListener() { |
| 40 | + @Override |
| 41 | + public void onLicenseVerified(boolean b, Exception e) { |
| 42 | + if(!b && e != null){ |
| 43 | + e.printStackTrace(); |
| 44 | + } |
| 45 | + } |
| 46 | +}); |
| 47 | +``` |
| 48 | +3. |
| 49 | +```objc |
| 50 | +[DSLicenseManager initLicense:@"DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" verificationDelegate:self]; |
| 51 | +- (void)onLicenseVerified:(bool)isSuccess error:(NSError *)error{ |
| 52 | + if(!isSuccess && error != nil){ |
| 53 | + NSString* msg = error.userInfo[NSUnderlyingErrorKey]; |
| 54 | + NSLog(@"%@", msg); |
| 55 | + } |
| 56 | +} |
| 57 | +``` |
| 58 | +4. |
| 59 | +```swift |
| 60 | +LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9",verificationDelegate:self) |
| 61 | +func onLicenseVerified(_ isSuccess: Bool, error: Error?) { |
| 62 | + if(!isSuccess && error != nil){ |
| 63 | + let err = error as NSError? |
| 64 | + let msg = err!.userInfo[NSUnderlyingErrorKey] as? String |
| 65 | + print(msg ?? "") |
| 66 | + } |
| 67 | +} |
| 68 | +``` |
| 69 | +5. |
| 70 | +```c |
| 71 | +char errorMessage[256]; |
| 72 | +DC_InitLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwNSJ9", errorMessage, 256); |
| 73 | +``` |
| 74 | +6. |
| 75 | +```cpp |
| 76 | +char errorMessage[256]; |
| 77 | +CLicenseManager::InitLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwNSJ9", errorMessage, 256); |
| 78 | +``` |
0 commit comments