DTWAIN_ExecuteOCR |
Top Previous Next |
The DTWAIN_ExecuteOCR function allows the selected OCR engine to process an image file.
BOOL DTWAIN_ExecuteOCR (
Parameters: Engine A selected OCR Engine
szFileName Name of image file to process.
startPage Starting page (if file is a multi-page image file).
endPage Ending page (if file is a multi-page image file).
Returns: TRUE if successful, otherwise FALSE is returned. If FALSE, use DTWAIN_GetLastError to get more information on the error.
Character specific version
Comments: DTWAIN_ExecuteOCR starts the selected OCR engine denoted by Engine. The szFileName is the name of the image file that is to be processed by the OCR engine.
The startPage and endPage arguments denote the starting page and ending page of the file that is to be processed. Page numbers are numbered from 0 to n-1 where n is the last page of the image file. For example, if the file is a single page file, the values of startPage and endPage must be 0.
If the file is a multi-page file, then startPage must be >= 0 and endpage >= startPage. For example, if we want to run the OCR engine only on the second page of the image file, startPage and endPage must be equal to 1. If we wanted to run the OCR engine on the second and third page, startPage must be 1 and endPage must be 2.
Please note that not all OCR engines can process multi-page image file. To discover if the selected OCR engine supports multi-page file, query the capability DTWAIN_OCRCV_MPIMAGEFILEFORMAT using the DTWAIN_GetOCRCapValues function.
Once DTWAIN_ExecuteOCR is finished, the text can be retrieved by calling DTWAIN_GetOCRText. More detailed information after the image has been processed by the OCR engine can be retrieved by calling DTWAIN_GetOCRTextInfoHandle, DTWAIN_GetOCRTextInfoLong, and DTWAIN_GetOCRTextInfoFloat.
Each time DTWAIN_ExecuteOCR is called on the same OCR engine, any previous text and text information that was retrieved from the OCR engine is deleted.
Example: Retrieve Text From an Image using OCR
Prerequisite Function Call(s) DTWAIN_SelectOCREngine, DTWAIN_SelectOCREngineByName, or DTWAIN_SelectDefaultOCREngine |