To add code to an existing project in order to work with recognition results:
1. Start with the program you created in Recognize Pages Using OCR Advantage.
2. Define the following global IDs in Ezfunc.h in the OCR_Ltocr directory:
#define IDM_SAVE_RESULTS 207
3. Edit EZFUNC.RC file in the OCR_Ltocr directory and add the following lines:
MAIN_MENU MENU
BEGIN
...
...
MENUITEM "Save Results" IDM_SAVE_RESULTS
END
4. 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;
5. Build SimpleLoad.exe.
6. Run SimpleLoad.exe.