title: Using Microsoft OCR Library with JS/jQuery in VS 2013
body: <p>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.</p>
  
  <p>I downloaded the <a href="https://code.msdn.microsoft.com/Uses-the-OCR-Library-to-2a9f5bf4">JavaScript sample app from MSDN</a> and I launched it : it is fully working (after installing the OCR plugin in VS 2013 of course).</p>
  
  <p>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 :</p>
  
  <blockquote>
    <p>Unmanagable exception on line 11, column 5 in ms-appx://io.cordova.blankcordovaapp2/www/scripts/myscript.js</p>
    
    <p>0x800a1391 - JavaScript execution error : « WindowsPreview » is undefined"</p>
  </blockquote>
  
  <p>Here is the "buggy" portion of code (it is at the very beginning of my script) : </p>
  
  <pre><code>$(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);
  </code></pre>
  
  <p>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 :</p>
  
  <blockquote>
    <p>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). </p>
  </blockquote>
  
  <p>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.</p>
  
  <p>Thanks in advance for your help and don't hesitate to ask for further detail if I wasn't clear enough.</p>