L_DocSaveResultsToMemory

#include "ltdoc.h"

L_LTDOC_API L_INT L_DocSaveResultsToMemory(hDoc, ppBuffer, plSize)

L_HDOC hDoc;

/* handle to the OCR document */

L_UCHAR ** ppBuffer;

/* address to buffer to be updated */

L_INT32 * plSize;

/* pointer to be updated */

Saves the last recognition process result to memory.

Parameter

Description

hDoc

Handle to the OCR document.

ppBuffer

Address of a pointer to be filled with the address of the final output document in memory.

plSize

Address of a variable to be updated with the length of the final output document.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Saves the results of the last recognition process to memory.

To free the memory associated with the recognition results, call L_DocFreeMemoryResults.

Call L_DocSaveResultsToMemory after the recognition process is complete to save the results to memory.

To recognize one or more pages, call L_DocRecognize.

To save the recognition results to a file, call L_DocSaveResultsToFile.

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_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocGetRecognizedWords, L_DocFreeRecognizedWords

Topics:

OCR Functions: Recognition

 

Recognizing Document Pages

Example

 L_INT DocSaveResultsToMemoryExample(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 = TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\testrdf.rdf");

   nRet = L_DocRecognize (hDoc, &RecogOpts, NULL, NULL);
   if (nRet == SUCCESS)
   {
      L_UCHAR * pResult = NULL;
      L_INT32 lResultSize = 0;
      nRet = L_DocSaveResultsToMemory(hDoc, &pResult, &lResultSize);
      if (nRet == SUCCESS)
      {
         //...
         //... process the results that available in pResult
         //...

         nRet = L_DocFreeMemoryResults(hDoc, &pResult);
         if(nRet != SUCCESS)
            return nRet;
      }
      else
         return nRet;
   }
   else
      return nRet;
   return SUCCESS;
}