I am currently working on a windows 8.1 application and I am using web languages and mostly jQuery (Cordova type project) as it might be used on other platforms. I need to use the Microsoft OCR Library (not Tesseract or any other ones, I know them but I really need to use this one for now) in order to analyze image and use the extracted text in my application.
I downloaded the JavaScript sample app from MSDN and I launched it : it is fully working (after installing the OCR plugin in VS 2013 of course).
I am now trying to integrate the OCR engine in my application (I installed the OCR plugin in my project too) but it is not working at all. In fact, when I try to launch my app on my machine, the execution fails and returns me this error message :
Unmanagable exception on line 11, column 5 in ms-appx://io.cordova.blankcordovaapp2/www/scripts/myscript.js
0x800a1391 - JavaScript execution error : « WindowsPreview » is undefined"
Here is the "buggy" portion of code (it is at the very beginning of my script) :
$(document).ready(function () {
"use strict";
// Keep objects in-scope across the lifetime of the scenario.
var FileToken = "";
// Define namespace and API aliases.
var FutureAccess = Windows.Storage.AccessCache.StorageApplicationPermissions.futureAccessList;
// Should be initialising the OCR engine
var OCR = WindowsPreview.Media.Ocr;
var ocrEngine = new OCR.OcrEngine(OCR.OcrLanguage.french);
document.addEventListener("deviceready", onDeviceReady, false);
I tried to initialize the OCR engine the same way as it is done in the microsoft OCR sample. VS seems not to find WindowsPreview.Media.Ocr which should be, according to the official documentation :
The Microsoft OCR Library for Windows Runtime contains the WindowsPreview.Media.Ocr namespace. The library is distributed as a NuGet package - it is not included in the Windows Software Development Kit (SDK).
I did install the plugin in the project using the NuGet command line so I don't know why it isn't identified and can't be initialized.
Thanks in advance for your help and don't hesitate to ask for further detail if I wasn't clear enough.