How to extract recognized text in FineReader Engine?


How to extract recognized text in FineReader Engine?


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

  • Receive the collection of table cells using the ITableBlock::Cells property.
  • Select the desired cell. Use the methods of the TableCells object.
  • Receive the block object of the cell (the ITableCell::Block property).
  • Check that the block is of type BT_Text (the IBlock::Type property) and receive the TextBlock object using the IBlock::GetAsTextBlock method.
  • Use the ITextBlock::Text property.

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 these methods, please refer to the Developer’s Help and our standard sample “RecognizedTextProcessing”.

Was this article helpful?

1 out of 6 found this helpful

Have more questions? Submit a request



Please sign in to leave a comment.