Closed riadapsis closed 5 years ago
Hey @riadapsis
Your code seems to be working for me. Are you using some framework like ionic, angular, phonegap etc. over the cordova implementation ? Or are you directly creating a cordova project as cordova create myproject
and then adding the plugin?
If you are using frameworks like ionic then in the file you are using the plugin in you need to define the textocr object.
declare var textocr;
Let me know if this was helpful!
If you could make a dummy project, recreate the issue, zip it and send it over, I could much more easily resolve the issue and get you to the solution.
Hi @ChrisTomAlx ,
Many thanks for your quick answer. I am using phonegap. My project is already in live. My app need a new feature like ocr. So, I install the plugin through npm (intel xdk is my ide). But it's not working. With the same procedure I have already added many plugin like barcode scanner etc. At the top of js file I add the line
var textocr;
But I got
Error: Uncaught TypeError: Cannot read property 'recText' of undefined in file:///android_asset/www/cordova.js at line 314
I am stuck with this.. Please help me out.
I tried getting the intel xdk ide to help you with the problem but it says they have discontinued it. Anyhow, I have a question for you.
Don't you have to add plugin as phonegap cordova plugin add cordova-plugin-mobile-ocr via the cordova cli tool? (Atleast that is how I had to do it) Will doing npm install be enough?
Also don't you have to remove platforms and re-add them for this to work? Could you check the config.xml of your project if the mobile ocr plugin is visible there ?
From what I have gathered I think it is an issue with the plugin not being installed. But I could be wrong!!
Sorry for the late response... I have uploaded the software to my google drive - url
You can download the file and see how they made the development too much easy!!! Waiting for your answer.
Accidentally closed the issue. sorry!
getting same error even though i have defined declare var textocr: any;
Error: ERROR Error: Uncaught (in promise): ReferenceError: textocr is not defined ReferenceError: textocr is not defined
Hi..
$('#camScan').click(function(){
navigator.camera.getPicture(onSuccessCam, onFailCam, { quality: 50, correctOrientation: true });
});
function onSuccessCam(imageData) {
try{
textocr.recText(0, /*3,*/ imageData, onSuccessRegc, onFailregc);
function onSuccessRegc(recognizedText) {
alert(recognizedText);
}
function onFailregc(message) {
alert('Failed because: ' + message);
}
}catch(err)
{
alert(err);
}
}
function onFailCam(message) {
alert('Failed because: ' + message);
}
used the above code for implementing OCR am getting error as ReferenceError:tectocr is not defined plz help me to sort it out
In Config.xml
<plugin name="cordova-plugin-mobile-ocr" spec="~3.1.1" />
While using the following code and run it, I can capture the image with camera. But success function return the error "textocr" is not defined.
If I change code from
textocr.recText(0, /*3,*/ imageData, onSuccessCam, onFailT);
tocordova.plugins.textocr.recText(0, /*3,*/ imageData, onSuccessCam, onFailT);
then I got -I am using Samsung J2 Prime with android version 6.0.1 (Plugin version 2.0.0)
Thanks in advance.