L_Doc2GetOutputFormatSettingsExt

#include "ltdoc2.h"

L_LTDOC2_API L_INT L_Doc2GetOutputFormatSettingsExt(hDoc, nDocId, formatType, uFlags, pFormatSettings, uStructSize)

Gets the settings for the specified output format.

Parameters

L_HDOC2 hDoc

Handle to the OCR document. This handle is obtained by calling the L_Doc2StartUp function.

L_INT nDocId

Document ID created by calling L_Doc2CreateDocument.

DOC2_FORMATTYPE formatType

The DOC2_FORMATTYPE format type for which its settings are being retrieved.

L_UINT uFlags

Flag that determines function behavior. Possible values are:

Value Meaning
DOC2_USE_FORMATTYPE_VALUE [0x0000] Gets the settings for the format specified in the formatType parameter.
DOC2_USE_COMMON_PDF_SETTINGS [0x0002] Gets common settings for PDF formats. pFormatSettings should be the address of PDFCOMMONSETTINGS.
DOC2_USE_COMMON_RTF_DOC_SETTINGS [0x0004] Gets common settings for RTF and DOC formats. pFormatSettings should be the address of RTFDOCWORDMLSETTINGS.
DOC2_USE_COMMON_TEXT_SETTINGS [0x0008] Gets common settings for TEXT formats. pFormatSettings should be the address of TEXTCOMMONSETTINGS.

L_VOID * pFormatSettings

Address of the settings structure to be updated.

L_UINT uStructSize

Size in bytes, of the structure. The structure used depends on the values of the formatType or uFlags parameter.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

These format settings are used in the output file. Use L_Doc2GetOutputFormatSettingsExtto obtain the 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 TEXTSETTINGS
DOC2_UTEXT UTEXTSETTINGS
DOC2_FORMATTED_TEXT TEXTFORMATTEDSETTINGS
DOC2_UFORMATTED_TEXT TEXTUFORMATTEDSETTINGS
DOC2_TEXT_LINEBREAKS TEXTLINEBREAKSSETTINGS
DOC2_UTEXT_LINEBREAKS UTEXTLINEBREAKSSETTINGS
DOC2_TEXT_CSV TEXTCSVSETTINGS
DOC2_TEXT_UCSV TEXTUCSVSETTINGS
DOC2_PDF PDFSETTINGS
DOC2_PDF_IMAGE_SUBSTITUTES PDFIMAGESUBSTSETTINGS
DOC2_PDF_IMAGE_ON_TEXT PDFIMAGEONTEXTSETTINGS
DOC2_PDF_EDITED PDFEDITEDSETTINGS
DOC2_XML XMLSETTINGS
DOC2_HTML_3_2 HTML32SETTINGS
DOC2_HTML_4_0 HTML40SETTINGS
DOC2_RTF_6 RTF6SETTINGS
DOC2_RTF_97 RTF97SETTINGS
DOC2_RTF_2000 RTF2000SETTINGS
DOC2_RTF_WORD_2000 RTF2000SWORDSETTINGS
DOC2_WORD_2007 WORD2007SETTINGS
DOC2_WORD_2000 WORD2000SETTINGS
DOC2_WORD_97 WORD97SETTINGS
DOC2_EXCEL_97 EXCEL97SETTINGS
DOC2_EXCEL_2000 EXCEL2000SETTINGS
DOC2_EXCEL_2007 EXCEL2007SETTINGS
DOC2_PPT_97 POWERPOINT97SETTINGS
DOC2_PUB_98 PUBLISHER98SETTINGS
DOC2_MICROSOFT_READER MSREADERSETTINGS
DOC2_WORDML WORDMLSETTINGS
DOC2_WORDPERFECT_8 WORDPERFECT8SETTINGS
DOC2_WORDPERFECT_10 WORDPERFECT10SETTINGS
DOC2_WORDPAD WORDPADSETTINGS
DOC2_INFOPATH INFOPATHSETTINGS
DOC2_EBOOK EBOOKSETTINGS

When one of the following flags is passed to the uFlags parameter, the function will ignore the format type passed to _formatType_:

To update the format settings call the L_Doc2SetOutputFormatSettings / L_Doc2SetOutputFormatSettingsExt function.

To save recognition results, call the L_Doc2SaveResultsToFile / L_Doc2SaveResultsToFileExt function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT Doc2OutputSettingsExampleExt(L_HDOC2 hDoc, L_INT nDocId, 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_Doc2RecognizeExt(hDoc, nDocId, &RecogOpts, NULL, NULL); 
   if (nRet == SUCCESS) 
   { 
      RESULTOPTIONS2 ResOpts; 
      ZeroMemory(&ResOpts, sizeof(RESULTOPTIONS2)); 
      nRet = L_Doc2GetRecognitionResultOptionsExt(hDoc, nDocId, &ResOpts, sizeof(RESULTOPTIONS2)); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      ResOpts.Format = DOC2_TEXT; 
      ResOpts.FormatLevel = DOC2_FORMAT_LEVEL_AUTO; 
      ResOpts.DocFormat = DOCUMENTFORMAT_USER; 
 
      nRet = L_Doc2SetRecognitionResultOptionsExt(hDoc, nDocId, &ResOpts); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      TEXTSETTINGS TxtSetng; 
      memset(&TxtSetng, 0, sizeof(TEXTSETTINGS)); 
      TxtSetng.uStructSize = sizeof(TEXTSETTINGS); 
 
      L_Doc2GetOutputFormatSettingsExt(hDoc, nDocId, DOC2_TEXT, DOC2_USE_FORMATTYPE_VALUE, &TxtSetng, sizeof(TEXTSETTINGS)); 
 
      TxtSetng.bBullets = TRUE; 
      TxtSetng.bPageBreaks = TRUE; 
      TxtSetng.pszPageBreak = L"MyPageBreak"; 
 
      L_Doc2SetOutputFormatSettingsExt(hDoc, nDocId, DOC2_TEXT, DOC2_USE_FORMATTYPE_VALUE, &TxtSetng); 
 
      nRet = L_Doc2SaveResultsToFileExt(hDoc, nDocId, MAKE_IMAGE_PATH(TEXT("test.txt")), DOC2_SAVE_PAGE_RESULTS); 
      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; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help