L_Doc2EnumOutputFileFormats

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2EnumOutputFileFormats(hDoc, pfnCallback, pUserData)

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

Parameters

L_HDOC2 hDoc

Handle to the OCR document.

ENUMOUTPUTFILEFORMATS2 pfnCallback

Callback function for returning available output file formats.

The L_Doc2EnumOutputFileFormats calls this callback function as it enumerates the available output formats. The callback function must adhere to the following function prototype: ENUMOUTPUTFILEFORMATS2.

L_VOID * 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

Value Meaning
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 ENUMOUTPUTFILEFORMATS2 callback.

To get the format information for each format, call the L_Doc2GetTextFormatInfo function.

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 the L_Doc2Recognize function.

To save the recognition results to a file, call the L_Doc2SaveResultsToFile function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

static L_HDOC2 hDoc; 
L_INT EXT_CALLBACK EnumOutputFileFormatsCB(DOC2_FORMATTYPE Format, 
                                           L_VOID* pUserData) 
{ 
   UNREFERENCED_PARAMETER(pUserData); 
 
   if (Format == DOC2_RTF_WORD_2000) 
   { 
      TEXTFORMATINFO2 FormatInfo; 
      memset(&FormatInfo, 0, sizeof(TEXTFORMATINFO2)); 
 
      L_INT nRet = L_Doc2GetTextFormatInfo(hDoc, Format, &FormatInfo, sizeof(TEXTFORMATINFO2)); 
      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) 
            GlobalFree(FormatInfo.pszDLLName); 
         if (FormatInfo.pszExtName) 
            GlobalFree(FormatInfo.pszExtName); 
         if (FormatInfo.pszName) 
            GlobalFree(FormatInfo.pszName); 
      } 
   } 
 
   return SUCCESS; 
} 
 
L_INT Doc2EnumOutputFileFormatsExample() 
{ 
   L_INT nRet; 
   nRet = L_Doc2StartUp(&hDoc, NULL); 
    if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_Doc2EnumOutputFileFormats(hDoc, (ENUMOUTPUTFILEFORMATS2) EnumOutputFileFormatsCB, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   L_Doc2ShutDown(&hDoc); 
 
   return SUCCESS; 
} 
Help Version 21.0.2021.3.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help