LEADTOOLS OCR C DLL Help > Function References > OCR Professional > L_Doc2EnumOutputFileFormats |
#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2EnumOutputFileFormats(hDoc, pfnCallback, pUserData)
L_HDOC2 hDoc; |
/* handle to the OCR document */ |
ENUMOUTPUTFILEFORMATS2 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. |
|
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. |
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 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
LTDOC2 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
Example
static L_HDOC 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_LTDOC2TEX_API L_INT Doc2EnumOutputFileFormatsExample() { L_INT nRet; nRet = L_Doc2StartUp(&hDoc, NULL, FALSE); if(nRet != SUCCESS) return nRet; nRet = L_Doc2EnumOutputFileFormats(hDoc, (ENUMOUTPUTFILEFORMATS2) EnumOutputFileFormatsCB, NULL); if(nRet != SUCCESS) return nRet; L_Doc2ShutDown(&hDoc); return SUCCESS; }