#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2GetOutputFormatSettings(hDoc, formatType, uFlags, pFormatSettings, uStructSize)
L_HDOC2 hDoc; |
/* handle to the OCR document */ |
DOC2_FORMATTYPE formatType; |
/* Format type */ |
L_UINT uFlags; |
/* flags */ |
L_VOID * pFormatSettings; |
/* pointer to format structure */ |
L_UINT uStructSize; |
/* size of the structure */ |
Gets the settings for the specified output format.
Parameter |
Description |
|
hDoc |
Handle to the OCR document. This handle is obtained by calling the L_Doc2StartUp function. |
|
formatType |
The format type for which its settings are being retrieved. |
|
uFlags |
Flag that determines function behavior. Possible values are: |
|
|
Value |
Meaning |
|
DOC2_USE_FORMATTYPE_VALUE |
[0x0000] Get the settings for the format specified in the formatType parameter. |
|
DOC2_USE_COMMON_PDF_SETTINGS |
[0x0002] Get common settings for PDF formats. pFormatSettings should be address of PDFCOMMONSETTINGS. |
|
DOC2_USE_COMMON_RTF_DOC_SETTINGS |
[0x0004] Get common settings for RTF and DOC formats. pFormatSettings should be the address of RTFDOCWORDMLSETTINGS. |
|
DOC2_USE_COMMON_TEXT_SETTINGS |
[0x0008] Get common settings for TEXT formats. pFormatSettings should be address of TEXTCOMMONSETTINGS. |
pFormatSettings |
Address of settings structure to be updated. |
|
uStructSize |
Size in bytes, of the structure. The structure is depend on the formatType or uFlags parameters. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
These format settings are used in the output file. Use this function to obtain format settings so they can be updated before saving the output file.
The pFormatSettings parameter is the address of the settings structure. The following table lists available format types along with the corresponding format settings structure that should be passed to this parameter:
Format Type Constant |
Format Settings Structure |
DOC2_TEXT |
|
DOC2_UTEXT |
|
DOC2_FORMATTED_TEXT |
|
DOC2_UFORMATTED_TEXT |
|
DOC2_TEXT_LINEBREAKS |
|
DOC2_UTEXT_LINEBREAKS |
|
DOC2_TEXT_CSV |
|
DOC2_TEXT_UCSV |
|
DOC2_PDF |
|
DOC2_PDF_IMAGE_SUBSTITUTES |
|
DOC2_PDF_IMAGE_ON_TEXT |
|
DOC2_PDF_EDITED |
|
DOC2_XML |
|
DOC2_HTML_3_2 |
|
DOC2_HTML_4_0 |
|
DOC2_RTF_6 |
|
DOC2_RTF_97 |
|
DOC2_RTF_2000 |
|
DOC2_RTF_WORD_2000 |
|
DOC2_WORD_2007 |
|
DOC2_WORD_2000 |
|
DOC2_WORD_97 |
|
DOC2_EXCEL_97 |
|
DOC2_EXCEL_2000 |
|
DOC2_EXCEL_2007 |
|
DOC2_PPT_97 |
|
DOC2_PUB_98 |
|
DOC2_MICROSOFT_READER |
|
DOC2_WORDML |
|
DOC2_WORDPERFECT_8 |
|
DOC2_WORDPERFECT_10 |
|
DOC2_WORDPAD |
|
DOC2_INFOPATH |
|
DOC2_EBOOK |
When one of the following flags is passed to the uFlags parameter the function will ignore the format type that is passed to formatType:
DOC2_USE_COMMON_PDF_SETTINGS
DOC2_USE_COMMON_RTF_DOC_SETTINGS
DOC2_USE_COMMON_TEXT_SETTINGS
To update the format settings call the L_Doc2SetOutputFormatSettings function.
To save recognition results, 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
Functions: |
L_Doc2GetRecognitionResultOptions, L_Doc2SetRecognitionResultOptions, L_Doc2SaveResultsToFile, L_Doc2SetOutputFormatSettings |
Topics: |
Example
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName L_LTDOC2TEX_API L_INT Doc2OutputSettingsExample(L_HDOC2 hDoc, L_INT nPageIndex) { L_INT nRet; RECOGNIZEOPTS2 RecogOpts; RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS2); RecogOpts.nPageIndexStart = nPageIndex; RecogOpts.nPagesCount = 1; RecogOpts.SpellLangId = DOC2_LANG_ID_ENGLISH; nRet = L_Doc2Recognize (hDoc, &RecogOpts, NULL, NULL); if (nRet == SUCCESS) { RESULTOPTIONS2 ResOpts; ZeroMemory(&ResOpts, sizeof(RESULTOPTIONS2)); nRet = L_Doc2GetRecognitionResultOptions(hDoc, &ResOpts, sizeof(RESULTOPTIONS2)); if(nRet != SUCCESS) return nRet; ResOpts.Format = DOC2_TEXT; ResOpts.FormatLevel = DOC2_FORMAT_LEVEL_AUTO; ResOpts.DocFormat = DOCUMENTFORMAT_USER; nRet = L_Doc2SetRecognitionResultOptions(hDoc, &ResOpts); if(nRet != SUCCESS) return nRet; TEXTSETTINGS TxtSetng; memset(&TxtSetng, 0, sizeof(TEXTSETTINGS)); TxtSetng.uStructSize = sizeof(TEXTSETTINGS); L_Doc2GetOutputFormatSettings(hDoc, DOC2_TEXT, DOC2_USE_FORMATTYPE_VALUE, &TxtSetng, sizeof(TEXTSETTINGS)); TxtSetng.bBullets = TRUE; TxtSetng.bPageBreaks = TRUE; TxtSetng.pszPageBreak = L"MyPageBreak"; L_Doc2SetOutputFormatSettings(hDoc, DOC2_TEXT, DOC2_USE_FORMATTYPE_VALUE, &TxtSetng); nRet = L_Doc2SaveResultsToFile(hDoc, MAKE_IMAGE_PATH(TEXT("test.txt"))); if (nRet == SUCCESS) MessageBox(NULL, TEXT("The recognition results were saved to a file."), TEXT("Notice!"), MB_OK); else return nRet; if (TxtSetng.pszLineBreak) GlobalFreePtr(TxtSetng.pszLineBreak); if (TxtSetng.pszPageBreak) GlobalFreePtr(TxtSetng.pszPageBreak); } else return nRet; return SUCCESS; }