Nicomsoft OCR: Developer's Guide


Img_GetImgText


Syntax

C++:int Img_GetImgText(HIMG ImgObj, UNICODECHAR* TextStr, int MaxLen, int Flags)
C#:int Img_GetImgText(int ImgObj, out string TextStr, int Flags)
Visual Basic:Function Img_GetImgText(ByVal ImgObj As Integer, ByRef TextStr As String, ByVal Flags As Integer) As Integer
Java:int Img_GetImgText(HIMG ImgObj, StringBuffer TextStr, int Flags)
Delphi:function Img_GetImgText(ImgObj:HIMG; TextStr:PWCHAR; MaxLen:integer; Flags:integer):integer


Description

Retrieves the recognized text for the entire image after performing OCR with the Img_OCR function.


Parameters

ImgObj [IN] – the Image object.
TextStr [OUT] – the buffer that will get the Unicode, null-terminated string containing the text.
MaxLen [IN] – the buffer size, in Unicode characters, including the null termination character. If 0, then the function will not copy anything to the buffer, but will only return the buffer size (in Unicode characters, without the null termination character) needed to store the text.
Flags [IN] – the Formatting flags. See the FMT_XXXXX constants for possible values.


Return value

If success, the text length in Unicode characters, without the null termination character; otherwise, an error code.


Remarks

The OCRSTEP_OCR step must be executed before calling this function.


Example

See the sample code for the Engine_InitializeAdvanced function.