How to extract information from a form photo in Node.JS using OCR

npm install cloudmersive-ocr-api-client --save
var CloudmersiveOcrApiClient = require('cloudmersive-ocr-api-client');var defaultClient = CloudmersiveOcrApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveOcrApiClient.ImageOcrApi();var imageFile = "/path/to/file"; // File | Image file to perform OCR on.  Common file formats such as PNG, JPEG are supported.var opts = {'bucketID': "bucketID_example", // String | Bucket ID of the Configuration Bucket storing the form templates'bucketSecretKey': "bucketSecretKey_example", // String | Bucket Secret Key of the Configuration Bucket storing the form templates'recognitionMode': "recognitionMode_example", // String | Optional, enable advanced recognition mode by specifying 'Advanced', enable handwriting recognition by specifying 'EnableHandwriting'.  Default is disabled.'preprocessing': "preprocessing_example", // String | Optional, preprocessing mode, default is 'Auto'.  Possible values are None (no preprocessing of the image), and Auto (automatic image enhancement of the image - including automatic unrotation of the image - before OCR is applied; this is recommended).  Set this to 'None' if you do not want to use automatic image unrotation and enhancement.'diagnostics': "diagnostics_example" // String | Optional, diagnostics mode, default is 'false'.  Possible values are 'true' (will set DiagnosticImage to a diagnostic PNG image in the result), and 'false' (no diagnostics are enabled; this is recommended for best performance).};var callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.imageOcrPhotoRecognizeFormAdvanced(imageFile, opts, callback);

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store