NeutrinosPlatform / cordova-plugin-mobile-ocr

A cordova plugin that can accept image URI or Base64 data and returns the text present in the image as string without need for network. You can also try :- https://github.com/NeutrinosPlatform/cordova-plugin-ml-text
MIT License
49 stars 30 forks source link

How do i pass 4 arguments ? #24

Closed ChaminThilakarathne closed 5 years ago

ChaminThilakarathne commented 5 years ago

Untitled

ChrisTomAlx commented 5 years ago

Hey @Chamiyalt Where are you getting this documentation from? Also what is plugin version are you using?

Cheers, Chris Neutrinos

ChaminThilakarathne commented 5 years ago

cordova-plugin-mobile-ocr 3.1.1 "Textocr"

ChaminThilakarathne commented 5 years ago

this is the documentation which i followed https://ionicframework.com/docs/native/ocr#usage

ChrisTomAlx commented 5 years ago

I did not create that documentation or the interface ionic uses. But as far as I can tell, you don't need to pass in success and failure. OCR.recText is a promise function, so you can just look for the resolve and reject, instead of passing in success and error callback functions.

So I guess the function call might look something like (got this from ionic docs) :-

this.ocr.recText(OCRSourceType.NORMFILEURL, "file://path/to/image.png")
  .then((res: OCRResult) => console.log(JSON.stringify(res)))
  .catch((error: any) => console.error(error));

The link you provided also backs up my claim. There is an example there. Try using the same example.

Cheers, Chris Neutrinos

ChaminThilakarathne commented 5 years ago

It was worked. Thanks a lot.

ChrisTomAlx commented 5 years ago

Awesome!

Cheers, Chris Neutrinos