Integrating Cordova plugin in Outsystems

1k views Asked by At

I'm using an open source plugin named Tesseract (Link) in my Outsystems project. I'm making the required changes, and I made 2 client actions as follows:

LoadLanguage:

TesseractPlugin.loadLanguage($parameters.language, 
function(response) {
  $resolve(response);
  $parameters.response = response;
}, 
function(reason) {
  $reject('Error on loading OCR file for your language. ' + reason);
  $parameters.reason = reason;
}

);

RecognizeText:

TesseractText.recognizeText($parameters.imageData, $parameters.language, 
function(recognizedText) {
  $parameters.text = recognizedText;
}, 
function(reason) {
  $reject('Error on recognizing text from image. ' + reason);
  $parameters.reason = reason;
}

);

I have added the URL to the Extensibility Configurations, but I keep getting the error: TesseractPlugin is not defined.

How do I fix it?

1

There are 1 answers

1
setilight On

I apologize if I'm just stating obvious things that you have done already, but often people forget something obvious. So...

1) Make sure the extensibility configurations in the eSpace you created for the plugin are in the following format:

{
    "plugin" :{
        "url": "https://github.com/gustavomazzoni/cordova-plugin-tesseract.git"
    }
}

2) Remember that cordova plugins can only be tested using a native build. They won't work on a browser or in OutSystemsNow.

3) Remember to generate a new native build for your app after you've added a reference to the plugin (from my experience this is the most common mistake).