L_DocEnumOutputFileFormats

#include "ltdoc.h"

L_LTDOC_API L_INT L_DocEnumOutputFileFormats(hDoc, pfnCallback, pUserData)

L_HDOC hDoc;

/* handle to the OCR document */

ENUMOUTPUTFILEFORMATS pfnCallback;

/* callback function */

L_VOID * pUserData;

/* pointer to more parameters for the callback */

Enumerates all available output file formats in the OCR document engine.

Parameter

Description

hDoc

Handle to the OCR document.

pfnCallback

Callback function for returning available output file formats.

 

L_DocEnumOutputFileFormats calls this callback function as it enumerates the available output formats.

 

The callback function must adhere to the following function prototype: ENUMOUTPUTFILEFORMATS.

pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs.

 

To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer to the appropriate data type to access your variable or structure.

 

If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Finds all available output text formats and reports them by calling the ENUMOUTPUTFILEFORMATS callback.

To get the format information for each format, call L_DocGetTextFormatInfo.

This function can be used to determine the available output file formats in the OCR document engine which can be used to save the recognition results.

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_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, ENUMOUTPUTFILEFORMATS

Topics:

OCR Functions: Recognition

 

Recognizing Document Pages

Example

static L_HDOC ghDoc;
L_INT EXT_CALLBACK EnumOutputFileFormatsCB(FORMAT_TYPE Format,
                                           L_VOID* pUserData)
{
   UNREFERENCED_PARAMETER(pUserData);

   if (Format == DOC_RTF_WORD_2000)
   {
      TEXTFORMATINFO FormatInfo;
      memset(&FormatInfo, 0, sizeof(TEXTFORMATINFO));

      L_INT nRet = L_DocGetTextFormatInfo(ghDoc, Format, &FormatInfo, sizeof(TEXTFORMATINFO));
      if (nRet == SUCCESS)
      {
         L_TCHAR szBuffer[1024];

         memset(szBuffer, 0, sizeof(szBuffer));
         wsprintf(szBuffer, TEXT("Format Name = %s\nFormat DLL Name = %s\nFormat Ext = %s\n"),
                  (FormatInfo.pszName) ? FormatInfo.pszName : TEXT(" "),
                  (FormatInfo.pszDLLName) ? FormatInfo.pszDLLName : TEXT(" "),
                  (FormatInfo.pszExtName) ? FormatInfo.pszExtName : TEXT(" "));

         MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK);

         if (FormatInfo.pszDLLName)
            GlobalFreePtr(FormatInfo.pszDLLName);
         if (FormatInfo.pszExtName)
            GlobalFreePtr(FormatInfo.pszExtName);
         if (FormatInfo.pszName)
            GlobalFreePtr(FormatInfo.pszName);
      }
   }

   return SUCCESS;
}

 L_INT DocEnumOutputFileFormatsExample(L_HDOC hDoc)
{
   L_INT nRet;
   ghDoc = hDoc;
   nRet = L_DocEnumOutputFileFormats(ghDoc, (ENUMOUTPUTFILEFORMATS) EnumOutputFileFormatsCB, NULL);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}