Resource Base
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

.Net API Reference - BarcodeReader License Methods

Method Description
InitLicenseFromServer Initializes license and connect to the specified server for online verification.
InitLicenseFromLicenseContent Initializes barcode reader license and connects to the specified server for online verification.
OutputLicenseToString Outputs the license content as an encrypted string from the license server to be used for offline license verification.
InitLTSConnectionParameters Initializes a DMLTSConnectionParameters struct with default values.
InitLicenseFromLTS Initializes the barcode reader license and connects to the specified server for online verification.

InitLicenseFromServer

Initializes the license and connect to the specified server for online verification.

int Dynamsoft.DBR.BarcodeReader.InitLicenseFromServer(string licenseServer, string licenseKey)

Parameters

[in] licenseServer <string> : The name/IP of the license server.
[in] licenseKey <string> : The license key of Barcode Reader.

Return value

Returns error code.

Code Snippet

int iLicMsg = -1;
BarcodeReader _br = new BarcodeReader();
// Connect to Dynamsoft server to verify the license. 
iLicMsg = _br.InitLicenseFromServer("", "licenseKey1;licenseKey2");
if(iLicMsg != 0)
{
   Console.WriteLine("License error Code:",iLicMsg);
   return; 
}
// Decode barcodes happens here
//....
_br.Dispose();

 

InitLicenseFromLicenseContent

Initializes barcode reader license and connects to the specified server for online verification.

int Dynamsoft.DBR.BarcodeReader.InitLicenseFromLicenseContent(string licenseKey, string strLicenseContent)

Parameters

[in] licenseKey <string> : The license key of Barcode Reader.
[in] pLicenseContent <string> : An encrypted string representing the license content (runtime number, expiry date, barcode type, etc.) obtained from the method OutputLicenseToString().

Return value

Returns error code.

Code Snippet

int iLicMsg = -1;
BarcodeReader _br = new BarcodeReader();
// Use the SDK offline 
iLicMsg = _br.InitLicenseFromLicenseContent("licenseKey1;licenseKey2", "LicenseContent");
if(iLicMsg != 0)
{
   Console.WriteLine("License error Code:",iLicMsg);
   return; 
}
// Decode barcodes happens here
//....
_br.Dispose();

 

OutputLicenseToString

Outputs the license content as an encrypted string from the license server to be used for offline license verification.

string Dynamsoft.DBR.BarcodeReader.OutputLicenseToString()

Return value

The output string which stores the contents of license.

Code Snippet

int iLicMsg = -1;
string path = @"Put your file path here";
// To be able to use the license key offline, you need to store the license file obtained from Dynamsoft server once you use the API, InitLicenseFromServer.
BarcodeReader _br = new BarcodeReader();
// Check if there is a license file in the local machine. If not, connect to Dynamsoft Hosted server to verify the license. Otherwise, use the local license file.
if (!File.Exists(path))
{
   // Connect to Dynamsoft server to verify the license
   iLicMsg = _br.InitLicenseFromServer("", "licenseKey1;licenseKey2");
   // The first parameter is the string of the license server. Leaving it empty ("") means it will connect to Dynamsoft License Server for online verification.
   if(iLicMsg != 0)
   {
      Console.WriteLine("License error Code:",iLicMsg);
      return; 
   }
   // If you wish to use SDK offline, store the license information as txt format
   string license = _br.OutputLicenseToString();
   File.WriteAllText(path, license);
}
else{
   // Use the local license file and use Dynamsoft Barcode Reader SDK 
   string license = File.ReadAllText(path);
   iLicMsg = _br.InitLicenseFromLicenseContent("licenseKey1;licenseKey2",license);
   if(iLicMsg != 0)
   {
      Console.WriteLine("Error Code:",iLicMsg);
      return; 
   }
}
// Decode barcodes happens here
//....

 

InitLTSConnectionParameters

Initializes a DMLTSConnectionParameters struct with default values.

DMLTSConnectionParameters Dynamsoft.DBR.BarcodeReader.InitLTSConnectionParameters()

Code Snippet

BarcodeReader reader = new BarcodeReader();
DMLTSConnectionParameters ltsInfo = reader.InitLTSConnectionParameters();
ltsInfo.HandShake = "*****-hs-****";
ltsInfo.SessionPassword = "******";
string errorMsg;
readr.InitLicenseFromLts(ltsInfo, out errorMsg);

 

InitLicenseFromLTS

Initializes the barcode reader license and connects to the specified server for online verification.

EnumErrorCode Dynamsoft.DBR.BarcodeReader.InitLicenseFromLTS(DMLTSConnectionParameters ltsConnectionParameters, out string errorMsg)

Parameters

[in] ltsConnectionParameters <string> : The struct DMLTSConnectionParameters with customized settings.
[in, out] errorMsg <string> : The detailed error message.

Return value

Returns error code.

Code Snippet

BarcodeReader reader = new BarcodeReader();
DMLTSConnectionParameters ltsInfo = reader.InitLTSConnectionParameters();
ltsInfo.HandShake = "*****-hs-****";
ltsInfo.SessionPassword = "******";
string errorMsg;
readr.InitLicenseFromLts(ltsInfo, out errorMsg);

 

This page is compatible for:

Version 7.5

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest Version
  • version 8.1.2
  • version 8.0
  • version 7.6
  • version 7.5
Change +
© 2003–2020 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support