L_DocSaveResultsToFile

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSaveResultsToFile(hDoc, pszFileName)

L_HDOC hDoc;

/* handle to the OCR document */

L_TCHAR L_FAR * 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 a page(s), 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

void TestSaveResultsToFile(L_HDOC hDoc, L_INT nPageIndex)
{
   RECOGNIZEOPTS RecogOpts;
   RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS);
   RecogOpts.nPageIndexStart = nPageIndex;
   RecogOpts.nPagesCount = 1;
   RecogOpts.SpellLangId = LANG_ID_ENGLISH;
   RecogOpts.pszFileName = TEXT("c:\\testrdf.rdf");

   L_INT nRet = L_DocRecognize (hDoc, &RecogOpts, NULL, NULL);
   if (nRet == SUCCESS)
   {
      RESULTOPTIONS ResOpts;
      memset(&ResOpts, 0, sizeof(RESULTOPTIONS));
      L_DocGetRecognitionResultOptions(hDoc, &ResOpts, sizeof(RESULTOPTIONS));

      ResOpts.Format = DOC_RTF_WORD_2000;
      ResOpts.FormatLevel = FORMAT_LEVEL_FULL;
      ResOpts.DocOptions.PaperSize = SEL_PREDEFINED;
      ResOpts.DocOptions.PaperType = PAPER_TYPE_A4;

      L_DocSetRecognitionResultOptions(hDoc, &ResOpts);

      nRet = L_DocSaveResultsToFile(hDoc, TEXT("c:\\test.doc"));
      if (nRet == SUCCESS)
         MessageBox(NULL, TEXT("The recognition results were saved to a file."), TEXT("Notice!"), MB_OK);
   }
}