#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 |
|
|
DOCUMENTFORMAT_EMF |
|
|
DOCUMENTFORMAT_DOC |
|
|
DOCUMENTFORMAT_PDF |
|
|
DOCUMENTFORMAT_RTF |
|
|
DOCUMENTFORMAT_TXT |
|
|
DOCUMENTFORMAT_HTM |
|
|
DOCUMENTFORMAT_XPS |
|
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 |
See Also
Functions: |
L_DocGetRecognitionResultOptions, L_DocSetRecognitionResultOptions, L_DocSaveResultsToFile, L_DocSetDocumentWriterOptions |
Topics: |
|
|
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; }