node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »



Allow to access ORC.SPACE api to send images and get the result

More Details:

IMPORTANT The OCR is provided by ocr space. I don't have anything with them, I just want to help sharing this library.


First - Register and Get your API key

Get you API key at ( Direct link : ). Just, follow their steps.

Second - Install npm package

  npm install ocr-space-api --save

Usage example

You can see and example at the folder example

const ocrSpaceApi = require('ocr-space-api');
var options =  { 
    apikey: '<your_api_key_here>',
    language: 'por', // Português 
    imageFormat: 'image/png', // Image Type (Only png ou gif is acceptable at the moment i wrote this) 
    isOverlayRequired: true
// Image file to upload 
const imageFilePath = "imageFile.jpg";
// Run and wait the result 
ocrSpaceApi.parseImageFromLocalFile(imageFilePath, options)
  .then(function (parsedResult) {
    console.log('parsedText: \n', parsedResult.parsedText);
    console.log('ocrParsedResult: \n', parsedResult.ocrParsedResult);
  }).catch(function (err) {
    console.log('ERROR:', err);



Default = False Allows you to specify if the image/pdf text overlay is required. Overlay could be used to show the text over the image