L_DocGetDocumentWriterOptions

#include "ltdoc.h"

L_LTDOC_API L_INT EXT_FUNCTION L_DocGetDocumentWriterOptions(hDoc, pOptions, uStructSize)

L_HDOC hDoc;

/* handle to the OCR document */

L_VOID * pOptions;

/* pointer to a document format structure */

L_UINT uStructSize;

/* sizeof the document format structure */

Gets options for the specified document writer format.

Parameter

Description

hDoc

Handle to the OCR document

pOptions

Void pointer to a document format structure to be set. Possible values are:

 

Format Constant

Document format structure

 

DOCUMENTFORMAT_LTD

DOCWRTLTDOPTIONS

 

DOCUMENTFORMAT_EMF

DOCWRTEMFOPTIONS

 

DOCUMENTFORMAT_DOC

DOCWRTDOCOPTIONS

 

DOCUMENTFORMAT_PDF

DOCWRTPDFOPTIONS

 

DOCUMENTFORMAT_RTF

DOCWRTRTFOPTIONS

 

DOCUMENTFORMAT_TXT

DOCWRTTXTOPTIONS

 

DOCUMENTFORMAT_HTM

DOCWRTHTMOPTIONS

 

DOCUMENTFORMAT_XPS

DOCWRTXPSOPTIONS

uStructSize

Size of the document format structure

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Gets the options for the format the document writer is to use to write results.

To specify a document writer format, fill the DocFormat member of the RESULTOPTIONS structure and pass it to the L_DocSetRecognitionResultOptions function.

To set the options for a specific document writer format, call the L_DocSetDocumentWriterOptions function.

After setting the document format and options, call L_DocSaveResultsToFile to save the results.

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_DocGetRecognitionResultOptions, L_DocSetRecognitionResultOptions, L_DocSaveResultsToFile, L_DocSetDocumentWriterOptions

Topics:

Recognizing Document Pages

 

OCR Functions: Document Writer

Example

 L_INT DocSaveResultsToDocumentWritersExample(L_HDOC hDoc, L_INT nPageIndex)
{
#if defined(LEADTOOLS_V16_OR_LATER)
   L_INT nRet;
   RECOGNIZEOPTS RecogOpts;
   RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS);
   RecogOpts.nPageIndexStart = nPageIndex;
   RecogOpts.nPagesCount = 1;
   RecogOpts.SpellLangId = LANG_ID_ENGLISH;
   RecogOpts.pszFileName = TEXT("c:\\testrdf.rdf");

   nRet = L_DocRecognize (hDoc, &RecogOpts, NULL, NULL);
   if (nRet == SUCCESS)
   {
      RESULTOPTIONS ResOpts;
      ZeroMemory(&ResOpts, sizeof(RESULTOPTIONS));
      nRet = L_DocGetRecognitionResultOptions(hDoc, &ResOpts, sizeof(RESULTOPTIONS));
      if(nRet != SUCCESS)
         return nRet;

      ResOpts.DocFormat = DOCUMENTFORMAT_PDF;
      nRet = L_DocSetRecognitionResultOptions(hDoc, &ResOpts);
      if(nRet != SUCCESS)
         return nRet;

      DOCWRTPDFOPTIONS PdfOptions;
      memset(&PdfOptions, 0, sizeof(DOCWRTPDFOPTIONS));
      PdfOptions.bImageOverText = TRUE;
      PdfOptions.PdfProfile = DOCWRTPDFPROFILE_PDF;
      L_DocSetDocumentWriterOptions(hDoc, &PdfOptions, sizeof(DOCWRTPDFOPTIONS));

      nRet = L_DocSaveResultsToFile(hDoc, TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Test_PDF.pdf"));
      if (nRet == SUCCESS)
         MessageBox(NULL, TEXT("The recognition results were saved to a file."), TEXT("Notice!"), MB_OK);
      else
         return nRet;

      L_DocGetDocumentWriterOptions(hDoc, &PdfOptions, sizeof(DOCWRTPDFOPTIONS));
      PdfOptions.PdfProfile = DOCWRTPDFPROFILE_PDFA;
      L_DocSetDocumentWriterOptions(hDoc, &PdfOptions, sizeof(DOCWRTPDFOPTIONS));

      nRet = L_DocSaveResultsToFile(hDoc, TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Test_PDFA.pdf"));
      if (nRet == SUCCESS)
         MessageBox(NULL, TEXT("The recognition results were saved to a file."), TEXT("Notice!"), MB_OK);
      else
         return nRet;
   }
   else
      return nRet;

#else
   UNREFERENCED_PARAMETER(hDoc);
   UNREFERENCED_PARAMETER(nPageIndex);
#endif // #if defined(LEADTOOLS_V16_OR_LATER)
   return SUCCESS;
}