Nicomsoft OCR: Developer's Guide


Blk_GetLineText


Syntax

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


Description

Retrieves the recognized text for the specified text line 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.


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.
TextStr [OUT] – the buffer that will get a 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 Img_GetBlockCnt function.