Closed sdegunst closed 5 years ago
I use the following version cordova-plugin-mobile-ocr : 2.0.0 cordova-plugin-document-scanner : 3.0.0
So returnType is no longer accepted from plugin version 2.x.x
So the recText call should look like this.
returnType is no longer required because all of them are returned as an object.
textocr.recText(sourceType, uriOrBase, successCallback, errorCallback)
scan.scanDoc(1, onSuccess, onFail);
function onSuccess(imageURI) {
textocr.recText(0, /*3,*/ imageURI, onSuccess, onFail); // removed returnType (here 3) from version 2.0.0
// for sourceType Use 0,2 // 1,3,4 won't work
function onSuccess(recognizedText) {
//var element = document.getElementById('pp');
//element.innerHTML=recognizedText;
//Use above two lines to show recognizedText in html
console.log(recognizedText);
alert(recognizedText);
}
function onFail(message) {
alert('Failed because: ' + message);
}
}
function onFail(message) {
alert('Failed because: ' + message);
}
ok, I didn't notice... (and the description is not up to date on npmjs) I try this and give you a feed back.
OK, I get an object... could you give us some information about this object ?
Here you go. Added this and example objects as the last section in the github readme. The basic structure of the object is as follows :-
After use of cordova-plugin-document-scanner, I try to launch cordova-plugin-mobile-ocr (recText with returnType 2) and I only get the word "Exception". It seems to be a result of an error catched in line 100 in Textocr.java...
when I launch adb locat, I have the following crash log
04-05 19:13:17.707 28191 28191 D CordovaActivity: Incoming Result. Request code = 99 04-05 19:13:17.707 28191 28191 D CordovaInterfaceImpl: Sending activity result to plugin 04-05 19:13:17.712 28191 28191 D CordovaActivity: Started the activity. 04-05 19:13:17.712 28191 28191 D CordovaActivity: Resumed the activity. 04-05 19:13:17.714 28191 1199 W System.err: java.lang.StringIndexOutOfBoundsException: length=1; regionStart=0; regionLength=6 04-05 19:13:17.715 28191 1199 W System.err: at java.lang.String.startEndAndLength(String.java:298) 04-05 19:13:17.715 28191 1199 W System.err: at java.lang.String.substring(String.java:1087) 04-05 19:13:17.715 28191 1199 W System.err: at com.neutrinos.ocrplugin.Textocr$1.run(Textocr.java:72) 04-05 19:13:17.715 28191 1199 W System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 04-05 19:13:17.715 28191 1199 W System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 04-05 19:13:17.715 28191 1199 W System.err: at java.lang.Thread.run(Thread.java:818) 04-05 19:13:17.715 28191 1199 W CordovaPlugin: Attempted to send a second callback for ID: Textocr533608263 04-05 19:13:17.715 28191 1199 W CordovaPlugin: Result was: "Error" 04-05 19:13:17.725 28191 1199 W DynamiteModule: Local module descriptor class for com.google.android.gms.vision.dynamite not found.