LEADTOOLS OCR C DLL Help > Function References > OCR Professional > L_Doc2SaveResultsToFile2 |
#include "l_bitmap.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2SaveResultsToFile2(hDoc, pszFileName, uFlags)
L_HDOC2 hDoc; |
/* handle to the OCR document */ |
L_TCHAR * pszFileName; |
/* the output file name */ |
L_UINT uFlags; |
/* flags determines the function behavior */ |
Saves the recognition results to a file
Parameter |
Description |
|
hDoc |
Handle to the OCR document. |
|
pszFileName |
Character string, which contains the name of the output file to be saved. |
|
uFlags |
Flag that determines the function behavior. Possible values are: |
|
|
Value |
Meaning |
|
0 |
The default behavior. It works as L_Doc2SaveResultsToFile. |
|
DOC2_SAVE_PAGE_RESULTS |
[0x001] Saves all page(s) results before saving it to final results. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
To recognize one or more pages, call the L_Doc2Recognize function.
To set save recognition results options, call the L_Doc2SetRecognitionResultOptions function.
To get the current save recognition results options, call the L_Doc2GetRecognitionResultOptions function.
To get all supported output formats, call the L_Doc2EnumOutputFileFormats function.
To get the format options, call the L_Doc2GetOutputFormatSettings function, and to update the format options, call the L_Doc2SetOutputFormatSettings function
Use L_Doc2SaveResultsToFile2 when you want to save the recognition results to different formats using the same recognition results while maintaining quality. Use L_Doc2SaveResultsToFile when memory is a constraint (it uses less memory than L_Doc2SaveResultsToFile2). However, L_Doc2SaveResultsToFile requires OCR to be performed separately for each file format in order to maintain quality.
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
Example
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName L_LTDOC2TEX_API L_INT Doc2SaveResultsToFile2Example(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.DocFormat = DOCUMENTFORMAT_PDF; nRet = L_Doc2SetRecognitionResultOptions(hDoc, &ResOpts); if(nRet != SUCCESS) return nRet; DOCWRTPDFOPTIONS PdfOptions; memset(&PdfOptions, 0, sizeof(DOCWRTPDFOPTIONS)); PdfOptions.bImageOverText = TRUE; PdfOptions.PdfProfile = DOCWRTPDFPROFILE_PDF; L_Doc2SetDocumentWriterOptions(hDoc, &PdfOptions, sizeof(DOCWRTPDFOPTIONS)); nRet = L_Doc2SaveResultsToFile2(hDoc, MAKE_IMAGE_PATH(TEXT("Test_PDF.pdf")), 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; L_Doc2GetDocumentWriterOptions(hDoc, &PdfOptions, sizeof(DOCWRTPDFOPTIONS)); PdfOptions.PdfProfile = DOCWRTPDFPROFILE_PDFA; L_Doc2SetDocumentWriterOptions(hDoc, &PdfOptions, sizeof(DOCWRTPDFOPTIONS)); nRet = L_Doc2SaveResultsToFile2(hDoc, MAKE_IMAGE_PATH(TEXT("Test_PDFA.pdf")), 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; } else return nRet; return SUCCESS; }