Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS OCR C DLL Help

L_DocSaveResultsToFile

Show in webframe

#include "ltdoc.h"

L_LTDOC_API L_INT L_DocSaveResultsToFile(hDoc, pszFileName)

L_HDOC hDoc;

/* handle to the OCR document */

L_TCHAR * pszFileName;

/* the output file name */

Saves the recognition results to a file.

Parameter

Description

hDoc

Handle to the OCR document.

pszFileName

Character string which contains the name of the output file to be saved.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Saves the recognition results to a file.

To recognize one or more pages, call L_DocRecognize.

To set save recognition results options, call L_DocSetRecognitionResultOptions.

To get the current save recognition results options, call L_DocGetRecognitionResultOptions.

To get all supported output formats, call L_DocEnumOutputFileFormats.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocGetRecognizedWords, L_DocFreeRecognizedWords

Topics:

OCR Functions: Recognition

 

Recognizing Document Pages

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


 L_INT DocSaveResultsToFileExample(L_HDOC hDoc, L_INT nPageIndex)
{
   L_INT nRet;
   RECOGNIZEOPTS RecogOpts;
   RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS);
   RecogOpts.nPageIndexStart = nPageIndex;
   RecogOpts.nPagesCount = 1;
   RecogOpts.SpellLangId = LANG_ID_ENGLISH;
   RecogOpts.pszFileName = MAKE_IMAGE_PATH(TEXT("testrdf.rdf"));

   nRet = L_DocRecognize (hDoc, &RecogOpts, NULL, NULL);
   if (nRet == SUCCESS)
   {
      RESULTOPTIONS ResOpts;
      ZeroMemory(&ResOpts, sizeof(RESULTOPTIONS));
      nRet = L_DocGetRecognitionResultOptions(hDoc, &ResOpts, sizeof(RESULTOPTIONS));
      if(nRet != SUCCESS)
         return nRet;

      ResOpts.Format = DOC_RTF_WORD_2000;
      ResOpts.FormatLevel = FORMAT_LEVEL_FULL;
      ResOpts.DocOptions.PaperSize = SEL_PREDEFINED;
      ResOpts.DocOptions.PaperType = PAPER_TYPE_A4;
#if defined(LEADTOOLS_V16_OR_LATER)
      ResOpts.DocFormat = DOCUMENTFORMAT_USER;
#endif // #if defined(LEADTOOLS_V16_OR_LATER)

      nRet = L_DocSetRecognitionResultOptions(hDoc, &ResOpts);
      if(nRet != SUCCESS)
         return nRet;

      nRet = L_DocSaveResultsToFile(hDoc, MAKE_IMAGE_PATH(TEXT("test.doc")));
      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;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.