<< Click to Display Table of Contents >> Navigation: OCR Module > High-Level Functions > OCR_SetCallBack |
OCR_SetCallBack sets the callback function for the PDF rasterization process. Please note that all elements are case-sensitive:
HRESULT PXCV_SetCallBack(
PXODocument Doc,
PXO_Callback_FUNC clbFN,
LPARAM clbparam
DWORD Flags=PXO_Origin_BottomLeft
);
Doc
Specifies the PXODocument that OCR_Init created.
clbfn
Specifies the callback function, which must be defined as:
typedef BOOL (__stdcall *PXO_CALLBACK_FUNC) (DWORD dwStage, DWORD dwLevel, LPARAM param);
Please note:
•The first parameter of clbfn indicates the callback state.
•The second parameter of clbfn indicates the progress level (see below).
•The third parameter of clbfn has the same value as that passed in UserData.
Please note that the maximum level will always be the number of input pages (or fields) multiplied by four. Therefore:
•(dwLevel - 1) / 4 (rounded down) gives the current working page number.
•(dwlevel % 4) gives the stage of the current working page:
•1 = rasterizing
•2 = auto-rotating and pre-processing image
•3 = running OCR
•0 = preparing output
CONSTANT
|
VALUE
|
MEANING OF dwLevel |
PXOClb_Start
|
1
|
MaxVal - maximum value of the level that will be passed.
|
PXOClb_Processing
|
2
|
Current progress level. This can be any value from 0 to MaxVal.
|
PXOClb_Finish
|
3
|
This can be any value from 0 to MaxVal. (MaxVal if all passed). This constant can be ignored if desired.
|
Please note that the callback function should return TRUE (any non-zero value) to continue processing or FALSE (zero) to abort the operation.
UserData specifies a user-defined callback parameter to be passed as a third parameter to the function that pProc specifies.
If the function succeeds then the return value is DS_OK.
If the function fails then the return value is an error code.