To add code to an existing project in order to work with recognition results:
Define the following global IDs in Ezfunc.h in the OCR_Ltocr directory:
#define IDM_SAVE_RESULTS 207 Edit EZFUNC.RC file in the OCR_Ltocr directory and add the following lines:
MAIN_MENU MENUBEGIN......MENUITEM "Save Results" IDM_SAVE_RESULTSEND
In the MainWndProc procedure, add the following code to the switch statement for WM_COMMAND:
case IDM_SAVE_RESULTS:{L_TCHAR szFileName[MAX_PATH] = {0};lstrcpy(szFileName, TEXT("C:\\Users\\Public\\Documents\\output.pdf"));nRet = L_OcrDocument_Save(hDocument, szFileName, DOCUMENTFORMAT_PDF, MyCallback, NULL);if (nRet != SUCCESS){wsprintf (achBuff, TEXT("Error %d in saving recognition results to a file"), nRet);MessageBox (NULL, achBuff, TEXT("Error"), MB_OK);}else{wsprintf (achBuff, TEXT("Successfully saved recognition results to %s"), szFileName);MessageBox (NULL, achBuff, TEXT("Notice"), MB_OK);}}break;
Build SimpleLoad.exe.