JavaScript OCR API for Your Web Application

Dynamsoft's OCR Professional Engine provides JavaScript OCR API which enables you easily embed OCR processing to your web application. With the JS OCR API, you can extract text from images, scanned PDFs and create searchable PDF files.

Along with the TWAIN scanning and webcam capture modules of Dynamic Web TWAIN, you can easily embed workflow for document/image capturing and content extracting online.

The Benefits of Client-Side OCR

  • No independency on the server-side language and server environment. You can use it in ASP.NET, PHP, JSP etc. applications.
  • Minimum data traffic for OCR processing
  • OCR Faster

How to use the JS OCR API

Include ocrpro.js in the head of your web application.

<head>
<script type="text/javascript" language="javascript"
src="Resources/addon/dynamsoft.webtwain.addon.ocrpro.js">
</head>

Download the client side OCR Pro DLL to the client machine.

var CurrentPathName = unescape(location.pathname);
CurrentPath = CurrentPathName.substring(0, CurrentPathName.lastIndexOf("/") + 1);
DWObject.Addon.OCRPro.Download(CurrentPath + "Resources/addon/OCRPro.zip", OnSuccess, OnFailure);

Extract text from images

DWObject.Addon.OCRPro.Recognize(0, GetOCRProInfo, GetErrorInfo); 
// OCR the 1st image in the buffer
var zoneArray = [];
var zone = Dynamsoft.WebTwain.Addon.OCRPro.NewOCRZone(_iLeft, _iTop, _iRight, _iBottom);
zoneArray.push(zone);
DWObject.Addon.OCRPro.RecognizeRect(0, zoneArray, GetRectOCRProInfo, GetErrorInfo); 
// OCR a zone of the image

Examples & Documentation

Check our code gallery for implementation examples. The Developer's Guide provides step-by-step guide to help you implement the OCR engine to your application.

Get started now