L_Doc2SaveResultsToFileExt

#include "ltdoc2.h"

L_LTDOC2_API L_INT L_Doc2SaveResultsToFileExt(hDoc, nDocId, pszFileName, uFlags)

Saves the recognition results to a file.

Parameters

L_HDOC2 hDoc

Handle to the OCR document.

L_INT nDocId

Document ID created by calling L_Doc2CreateDocument.

L_TCHAR * pszFileName

Character string, containing the name of the output file to be saved.

L_UINT uFlags

Flags that determine function behavior.  Possible values are:

Value Meaning
0 The default behavior. It works the same as L_Doc2SaveResultsToFile.
DOC2_SAVE_PAGE_RESULTS [0x001] Save all page(s) results before saving it to the final results.

Returns

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

Comments

To recognize one or more pages, call the L_Doc2Recognize / L_Doc2RecognizeExt function.

Set save recognition results options by calling L_Doc2SetRecognitionResultOptions / L_Doc2SetRecognitionResultOptionsExt.

To get the current save recognition results options, call the L_Doc2GetRecognitionResultOptions / L_Doc2GetRecognitionResultOptionsExt function.

Get all supported output formats by calling L_Doc2EnumOutputFileFormats.

To get format options, call the L_Doc2GetOutputFormatSettings / L_Doc2GetOutputFormatSettingsExt function. To update format options, call the L_Doc2SetOutputFormatSettings / L_Doc2SetOutputFormatSettingsExt function.

Use L_Doc2SaveResultsToFile2 to save the recognition results to different formats using the same recognition results and at the same time maintain quality. However, it consumes more memory than L_Doc2SaveResultsToFile / L_Doc2SaveResultsToFileExt.

If memory is a constraint, use L_Doc2SaveResultsToFile / L_Doc2SaveResultsToFileExt instead. However, L_Doc2SaveResultsToFile / L_Doc2SaveResultsToFileExt requires OCR to be performed separately for each file format in order to maintain quality.

The difference between L_Doc2SaveResultsToFile and L_Doc2SaveResultsToFileExt is that L_Doc2SaveResultsToFileExt includes the document ID parameter (nDocId).

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT Doc2SaveResultsToFileExampleExt(L_HDOC2 hDoc, L_INT nDocId, L_INT nPageIndex) 
{ 
   L_INT nRet; 
   RECOGNIZEOPTS2 RecogOpts; 
   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); 
      else 
         return nRet; 
   } 
   else 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.