Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS OCR C DLL Help

L_DocGetDocumentWriterOptions

Show in webframe

#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

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


 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 = MAKE_IMAGE_PATH(TEXT("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, MAKE_IMAGE_PATH(TEXT("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, MAKE_IMAGE_PATH(TEXT("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;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.