Nicomsoft OCR: Developer's Guide


Blk_GetCharText


Syntax

C++:int Blk_GetCharText(HBLK BlkObj, int LineIndex, int WordIndex, int CharIndex, int ResultIndex, UNICODECHAR* TextStr, int MaxLen)
C#:int Blk_GetCharText(int BlkObj, int LineIndex, int WordIndex, int CharIndex, int ResultIndex, out string TextStr)
Visual Basic:Function Blk_GetCharText(ByVal BlkObj As Integer, ByVal LineIndex As Integer, ByVal WordIndex As Integer, ByVal CharIndex As Integer, ByVal ResultIndex As Integer, ByRef TextStr As String) As Integer
Java:int Blk_GetCharText(HBLK BlkObj, int LineIndex, int WordIndex, int CharIndex, int ResultIndex, StringBuffer TextStr)
Delphi:function Blk_GetCharText(BlkObj:HBLK; LineIndex:integer; WordIndex:integer; CharIndex:integer; ResultIndex:integer; TextStr:PWCHAR; MaxLen:integer):integer


Description

Retrieves the recognized text for the specified character in the block after performing OCR with the Img_OCR function. Use the Blk_GetLineCnt function to get the total number of text lines in the block. Use the Blk_GetWordCnt function to get the total number of words in the specified line. Use the Blk_GetCharCnt function to get the total number of characters in the specified word.


Parameters

BlkObj [IN] – the Block object. You can also specify the Image object if you want to work with the global list of text lines for the entire image.
LineIndex [IN] – the index of the text line to retrieve; 0 – the first line.
WordIndex [IN] – the index of the word in the specified text line to retrieve; 0 – the first word.
CharIndex [IN] – the index of the character in the specified word; 0 – the first character.
ResultIndex [IN] – the index of the character variant. Specify 0 to get the best (selected) variant.
TextStr [OUT] – the buffer that will get the Unicode, null-terminated string with 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.


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 Blk_GetCharCnt function.