TABLE OF CONTENTS


GENERAL PRODUCT DOCUMENTATION


CURRENT VERSION

2021.02 – released March 2021


SYSTEM REQUIREMENTS AND PRE-REQUISITES

  • Microsoft .NET 4.6.1 Framework or later.

PREPARATION FOR USAGE

  • Add to our project files "ConPDS_OCR.dll", "keys" (Visual Studion -> Solutions Explorer call Context Menu for project Add -> Existing Item)  set the value of the file property "Copy to output directory" -> "Copy always".
  • Add library  ConPDS.Net.dll to project as NET reference.
  • Modify the license file "keys" and insert the api_key and license_key provided to you via email.
  • Finally, add a reference to the wrapper "ConPDS.Net.dll" inside your .NET project. To add the wrapper ConPDS.Net.dll to the .NET project, it's needed in the window SolutionExplorer to make a right mouse click on element References and select item AddReference..., find file ConPDS.Net.dll in the file system and select it.


USING THE LIBRARY

Library offers the following two methods:

  • string ConPDS.Net.Proxy.RecogFromBMPToJSON(System.Drawing.Image image)
    • Input parameter – picture for recognition
    • The function returns a string in JSON format
  • string ConPDS.Net.Proxy. RecogFromBufferToJSON (byte[] buffer)
    • Input parameter – image file data  (bytes array)
    • The function returns a string in JSON format


Example of usage

private void btnLoad_Click(object sender, RoutedEventArgs e)
{
  try
            {
                string jsonData = ConPDS.Net.Proxy.RecogFromFileToJson(img);

                if (!string.IsNullOrEmpty(jsonData))
                {
                    dynamic data = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonData);
                    this.imageToJson.SetDataResult("RecogFromFileToJson", jsonData, data.result.ToString());
                }
            }
            catch (ExternalException extExc)
            {
                this.imageToJson.SetDataResult("RecogFromFileToJson", extExc.Message, string.Empty);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error:");
            }
} 


  private async void RecogFromBufferToJSON(System.Drawing.Image img)
        {
            try
            {
                byte[] buffer = Utils.ConvertImageToBuffer(img);
                string jsonData = ConPDS.Net.Proxy.RecogFromBufferToJson(buffer);

                if (!string.IsNullOrEmpty(jsonData))
                {
                    dynamic data = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonData);
                    this.bufferToJson.SetDataResult("RecogFromBufferToJson", jsonData, data.result.ToString());
                }
            }
            catch (ExternalException extExc)
            {
                this.imageToJson.SetDataResult("RecogFromBufferToJson", extExc.Message, string.Empty);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error:");
            }
        }


Process results of recognizing

Two methods may be called during the recognition process.

  • string RecogFromBMPToJSON(Image image);
  • string RecogFromBufferToJSON (byte[] buffer);


Description of the returned string, check the section OCR ENGINE OUTPUT.

This method is called when an error has been occurred in the license checking or recognizing process.

  • In case of error, the library raises exception ExternalException, which contains a message with the reason for the issue.

License checking errors

  • invalidServerPublicKey: Invalid server public key
  • invalidJSONResponse: Invalid JSON response
  • invalidResponse: Invalid response from server
  • invalidURL: Invalid server URL
  • invalidDevicId: Error while getting device ID
  • timeOut: Request timeout.
  • invalidAPIKey: Invalid API key


EXAMPLE PROJECTS (SOURCE CODE)