Knowledge Base

Article ID: 1582 | Category: General Questions | Type: How To | Last Modified: 12/13/2016

How to get recognized text?


How can I get recognized text?


Please note that only text, table, and barcode blocks contain text after recognition. Other blocks have no text.

To access the recognized text of a block, do the following:

For text blocks
Use the ITextBlock::Text property.

For table blocks

For barcode blocks
Receive the barcode text using the IBarcodeBlock::BarcodeText or IBarcodeBlock::Text property. The first one returns the BarcodeText object, which is a collection of characters of the recognized barcode (the BarcodeSymbol objects). The second one returns the text of the barcode as a single string. The BarcodeText allows you to edit the text of the barcode. The IBarcodeBlock::Text property is read-only.

Please find below C# code snippet which shows how to get all text from TextBlock objects and write it to the string:

string text = "";

for ( int i = 0; i < frDocument.Pages.Count; i++ ){
	FREngine.LayoutBlocks blocks = frDocument.Pages[i].Layout.Blocks;
	for ( int j = 0; j < blocks.Count; j++ ){
		FREngine.IBlock block = blocks.Item(j);
		if (block.Type == FREngine.BlockTypeEnum.BT_Text){
			FREngine.TextBlock textBlock = block.GetAsTextBlock();
			for (int k = 0; k < textBlock.Text.Paragraphs.Count; k++){
				FREngine.Paragraph paragraph = textBlock.Text.Paragraphs[k];
				text += paragraph.Text;

For more information about using of these methods please refer to the Developer’s Help and our standard sample “RecognizedTextProcessing”.

217 people think this is helpful.
Was this information helpful to you?