L_Doc2SetPreProcessingOptionsExt

#include "ltdoc2.h"

L_LTDOC2_API L_INT L_Doc2SetPreProcessingOptionsExt(hDoc, nDocId, pOptions)

Sets the engine's pre-processing options.

Parameters

L_HDOC2 hDoc

Handle to the OCR document. This handle is obtained by calling L_Doc2StartUp.

L_INT nDocId

Document ID created by calling L_Doc2CreateDocument.

pDOC2PREPROCESSINGOPTIONS pOptions

Pointer to a DOC2PREPROCESSINGOPTIONS structure containing the pre-processing options to be set.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

To get the current engine's pre-processing options, call L_Doc2GetPreProcessingOptions / L_Doc2GetPreProcessingOptionsExt.

✎ NOTE

Be sure to call L_Doc2SetPreProcessingOptionsExt before calling L_Doc2FindZones / L_Doc2FindZonesExt or L_Doc2Recognize / L_Doc2RecognizeExt because these options affect the auto-zoning and recognition results.

Required DLLs and Libraries

See Also

Functions

Topics

Example

For an example, refer to L_Doc2SetPreProcessingOptionsExt.

L_INT Doc2SetPreProcessingOptionsExampleExt(L_HDOC2 hDoc, L_INT nDocId, L_INT nPageIndex) 
{ 
   L_INT nRet = FAILURE; 
   DOC2PREPROCESSINGOPTIONS options; 
   RECOGNIZEOPTS2 RecogOpts; 
 
   ZeroMemory(&options, sizeof(DOC2PREPROCESSINGOPTIONS)); 
 
   nRet = L_Doc2GetPreProcessingOptionsExt(hDoc, nDocId, &options, sizeof(DOC2PREPROCESSINGOPTIONS)); 
   if(nRet == SUCCESS) 
   { 
      options.BinarizationMode = DOC2_CONVERSION_SET; 
      options.nThreshold = 218; 
 
      nRet = L_Doc2SetPreProcessingOptionsExt(hDoc, nDocId, &options); 
      if(nRet == SUCCESS) 
      { 
         L_Doc2FindZonesExt(hDoc, nDocId, nPageIndex); 
 
         RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS2); 
         RecogOpts.nPageIndexStart = nPageIndex; 
         RecogOpts.nPagesCount = 1; 
         RecogOpts.SpellLangId = DOC2_LANG_ID_ENGLISH; 
 
         nRet = L_Doc2RecognizeExt (hDoc, nDocId, &RecogOpts, NULL, NULL); 
         if (nRet == SUCCESS) 
         { 
            RESULTOPTIONS2 ResOpts; 
 
            ZeroMemory(&ResOpts, sizeof(RESULTOPTIONS2)); 
            nRet = L_Doc2GetRecognitionResultOptionsExt(hDoc, nDocId, &ResOpts, sizeof(RESULTOPTIONS2)); 
            if(nRet != SUCCESS) 
               return nRet; 
 
            ResOpts.Format = DOC2_WORD_2000; 
            ResOpts.FormatLevel = DOC2_FORMAT_LEVEL_AUTO; 
            ResOpts.DocFormat = DOCUMENTFORMAT_USER; 
 
            nRet = L_Doc2SetRecognitionResultOptionsExt(hDoc, nDocId, &ResOpts); 
            if(nRet != SUCCESS) 
               return nRet; 
 
            nRet = L_Doc2SaveResultsToFileExt(hDoc, nDocId, MAKE_IMAGE_PATH(TEXT("test.doc")), DOC2_SAVE_PAGE_RESULTS); 
            if (nRet == SUCCESS) 
               MessageBox(NULL, TEXT("The recognition results were saved to a file."), TEXT("Notice!"), MB_OK); 
         } 
      } 
   } 
 
   return nRet; 
} 

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help