[Cloud] Apache Cordova

  • Last Post 05 August 2014
ericpres posted this 05 August 2014

I am attempting to OCR a picture taken with a mobile phone within my native application built with the Cordova mobile application development platform. I get the following error when I attempt to process the image.

<?xml version="1.0" encoding="utf-8"?><error><message language="english">Unsupported image file format</message></error>

The error is returned when I post the jpeg image to the Cloud OCR processImage method:


I am also sending the "Content-Type: image/jpeg" header to identify the content.

The picture I am sending was taken with the phone and saved to the local file system on the phone. When I read the picture from the local file system with Cordova I have several options: readAsDataURL, readAsText, readAsBinaryString, and readAsArrayBuffer. I have tried them all and get the same error. These different options are documented here: Cordova FileReader Methods.

Anastasia Galimova posted this 05 August 2014

We have not got a ready sample code or instructions for using ABBYY Cloud OCR SDK in Apache Cordova. According to Cordova web-site, this framework supports JavaScript. We also have a sample on this language: http://ocrsdk.com/documentation/code-samples/. But we have not found which modules of JavaScript can be used in this framework. Our sample uses library from node .js, and if Cordova supports it, JavaScript sample should work.

To debug your code we recommend to use any HTTP debugger (for example, Fiddler). You can send to CloudOCRSDK@abbyy.com the log to get additional recommendations.