Aspose.OCR  for JavaScript via C++

Convert images and PDFs to text in JavaScript

Add optical character recognition (OCR) to your Web applications with a few lines of code.

  Download Free Trial
  
 

Aspose.OCR for JavaScript via C++ extends your applications with optical character recognition capabilities in 8 lines of code. Our experience in neural networks and machine learning has been translated into an OCR library with superior performance and accuracy that supports 26 languages based on Latin and Cyrillic scrips as well as Chinese. OCR API can recognize scanned images, smartphone photos, screenshots, areas of images, and scanned PDFs and return results in the most popular document and data exchange formats. It is completely offline and does not require an internet connection to work. The API requires minimal effort to get started and a shallow learning curve to master. All pre-processing, skew correction, noise removal, language detection, multi-threading and other complex tasks are performed automatically, but can be tuned up to deal with hard cases.

Advanced JavaScript via C++ OCR API Features

Extracts text from images and creates searchable PDFs

Supports any image you can get form a scanner or camera

Reads Extended Latin and Cyrillic scripts

Recognizes over 6,000 Chinese characters

Detects and recognizes all popular typefaces and formatting

Pre-processes images before recognition

Processes the whole image or selected areas only

Supports rotated, skewed and noisy images

Batch recognition of all images in a folder or archive

Recognizes images provided as web links

Finds and automatically corrects misspelled words

Get recognition result as JSON

Easy to Use

Do you still think JavaScript OCR is hard? With our library, you only need 8 lines of code to recognize the image and display the result. Try this code and see for yourself:

Ready to recognize Recognizing Drop a file here or click to browse *

* By uploading your files or using the service you agree with our Terms of use and Privacy Policy.

Live code sample - JavaScript


// Prepare input
var input = Module.WasmAsposeOCRInput();
var inputs = new Module.WasmAsposeOCRInputs();
// Prepare settings
var settings = Module.WasmAsposeOCRRecognitionSettings();
input.url = "<file name>";
inputs.push_back(input);
var result = Module.AsposeOCRRecognize(inputs, settings);
// Serrialize result
var result_str = Module.AsposeOCRSerializeResult(result, Module.ExportFormat.text);
console.log(result_str);
Recognition result
 

26 Recognition Languages

OCR API can recognize a large number of languages and all popular writing scripts, including texts with mixed languages.

  • Extended Latin alphabet: Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, German, Italian, Latvian, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Slovak, Slovenian, Spanish, Swedish.
  • Cyrillic alphabet: Belorussian, Bulgarian, Kazakh, Russian, Serbian, Ukrainian.
  • Chinese: more than 6,000 characters.

You can leave the language detection to the library or define the language yourself to increase the recognition performance and reliability.

Batch Processing

OCR API frees you from recognizing every image one-by-one by offering various batch-processing methods that allow you to recognize multiple images in one call:

  • Recognition of multi-page PDF and TIFF files.
  • Recognition of all files in a folder.
  • Recognition of all files in an archive.

Recognize ZIP archive - JavaScript


// Prepare input
var input = Module.WasmAsposeOCRInput();
// Provide archive path
input.url = "archive.zip";
var inputs = new Module.WasmAsposeOCRInputs();
// Prepare settings
var settings = Module.WasmAsposeOCRRecognitionSettings();
inputs.push_back(input);
var result = Module.AsposeOCRRecognize(inputs, settings);
// Serrialize result
var result_str = Module.AsposeOCRSerializeResult(result, Module.ExportFormat.text);

Preserve Formatting

The OCR library reads all popular typefaces such as Arial, Times New Roman, Courier New, Tahoma, Calibri and more in regular, bold and italic styles and carefully preserves formatting in OCR results. You can also split recognition results into lines and detect text areas in a page.

Recognize Photos

The widespread adoption of OCR applications is usually stopped by the fact that scanners are not commonplace for most users. Our OCR library has powerful built-in image pre-processing filters that can handle dark, rotated, skewed, and noisy images. In combination with support for all image formats, it allows for reliable recognition of even smartphone photos. Most of the pre-processing and image correction is done automatically, so you will only have to intervene in difficult cases.

Set custom angle for skew correction - JavaScript

// Prepare input
var input = Module.WasmAsposeOCRInput();
input.url = "../Data/Source/sample.png";
var inputs = new Module.WasmAsposeOCRInputs();
// Prepare settings
var settings = Module.WasmAsposeOCRRecognitionSettings();
settings.skew = 5;
var rects = [ {x: 90, y:186, width:775, height:95} , { x:928, y:606, width:790, height:160 } ];
settings.rects = rects;
inputs.push_back(input);
var result = Module.AsposeOCRRecognize(inputs, settings);
// Serrialize result
var result_str = Module.AsposeOCRSerializeResult(result, Module.ExportFormat.text);

Spell Check

While the OCR produces reliable results, dust and print defects might cause some symbols to be recognized incorrectly. OCR API has a built-in spell checker that automatically replaces misspelled words and frees you from having to manually correct the recognition results.

  

Support and Learning Resources

  
  

Aspose also offers native OCR APIs for other popular programming languages: