The OCR solution for Node.js developers.
What is OCR Xpress?
OCR Xpress for Node.js enables you to add OCR capabilities to your applications.
- Text or PDF output - recognize text from BMP files and convert to searchable text or multiple-page PDF files.
- Structured Results - results are organized in a hierarchical model where every character is tied to a word, text line, text block, region, and page.
- Languages - recognize text in over 30 different languages.
- Simple - by providing only a minimal asynchronous API, OCR Xpress is easy to learn. With a few lines of code, recognize text found in images produced by scanners, cameras, or fax machines.
OCR with less than 20 lines of code
- Make sure you have the following system requirements:
Linux 64 bit
node -v
x64 6.8 or greater and npm.gcc --version
4.8.1 or greater.g++ -v
4.8.1 or greater.java -version
x64 JRE 1.8
Windows 64 bit
node -v
x64 6.8 or greater and npm.java -version
x64 JRE 1.8python -V
2.7.x- Common Tool for C++ from Visual Studio 2015
- This can be done via the free Community Edition of Visual Studio 2015. Insure you click on the check mark for
Common Tools for C++
during the installation process of Visual Studio 2015.
NOTE: Be sure the path you're installing from does not contain a SPACE in the file path. This may cause issues when installing or registering the product.
- Set node build tools (Windows only)
npm config set python python2.7
npm config set msvs_version 2015
- Register an email address for a free account to get access to our OCR Xpress evaluation version
- Run
npm install ocr
- Run the license utility to install an evaluation license. When prompted enter the email you registered with in step 2:
- to launch window:
cd node_modules/ocr && npm run register
- to register manually:
cd node_modules/ocr && npm run register -- youremail@domain.com
- Use the following to get a taste of what OCR Xpress can do:
var ocr = require('ocr');
var params = {
input: './node_modules/ocr/samples/images/color.bmp',
output: './out.txt',
format: 'text'
};
ocr.recognize(params, function(err, document){
if(err)
console.error(err);
else{
console.log(document);
}
});
Accessing Results
The Results Manager is a collection of "get" functions that returns an array of various result objects.
For example, to get the text of the first word recognized in the document:
var textLine = document.getWords()[0].text;
Resulting objects return more than just text. The following provides access to characters, words, and the bounding box of the first line of text, inside the first region of text recognized in the document:
var textLine = document.getRegions()[0].getTextLines()[0];
It is also possible to control the output of the result by adjusting recognition parameters. For example,
var params = {
output: './out.pdf',
format: 'pdf'
};
There are many other OCR capabilities such as page rotation, multiple supported languages, recognition confidence, and much more.
More Documentation and Support
OCR Xpress also includes detailed API documentation, a Getting Started guide, and code samples
- Navigate to the node_modules/ocr/samples/ directory and check out more code samples.
- Need more documentation? Check out the [User's Guide](http://help.accusoft.com/OCR Xpress/v4.0/nodejs/webframe.html).
- Need help? Call Accusoft at (813) 875-7575.