Return >  Addon.OCR.RecognizeSelectedImages

Addon.OCR.RecognizeSelectedImages()

Description

Performs OCR on the currently selected images in the buffer.

Syntax

.Addon.OCR.RecognizeSelectedImages(asyncSuccessFunc, asyncFailureFunc);

Parameters

<OnOCRSuccess function> AsyncSuccessFunc: callback function triggered when OCR is executed successfully. This function can acquire the OCR'd image's index and the OCR result. For details, please refer to result.
<OnOCRFailure function> AsyncFailureFunc: callback function triggered when executing OCR fails.

Please refer to the function prototype OnOCRSuccess or OnOCRFailure.

Return value

bool

true indicates success. false indicates failure.

When false is returned or an exception is thrown, please check the methods result.GetErrorCode and the result.GetErrorString for error information.

Example

function btnOCR_onclick() {
 var filePath = "D:\\OCRResult\\OCResult.pdf";
 var strHTTPServer = location.hostname;
 var CurrentPathName = unescape(location.pathname);
 var CurrentPath = CurrentPathName.substring(0, CurrentPathName.lastIndexOf("/") + 1);
 var appPath = "http://" + strHTTPServer + ":" + location.port + CurrentPath;
 
 DWObject.Addon.OCR.DownloadLangData(appPath +"Resources/addon/English.zip", function(){
  DWObject.Addon.OCR.Download(appPath +"Resources/addon/OCR.zip", 
   function () {
    DWObject.Addon.OCR.RecognizeSelectedImages(
     function (result) {
      console.log(result.GetInput());
      result.Save(filePath);       
     },        
     function (errorCode, errorString) {alert(errorString);}
    );
   }, 
   function (errorCode, errorString) {alert(errorString); }
  );},
  function (errorCode, errorString) {alert(errorString); }
 );
}

See Also

result.GetInput
Addon.OCR.Recognize