I've been asked to evaulate the FR11 Engine if it will work with our requirements? Now I need to know if it possible to only recognize a specific region of a PDF document? I have the coordinates for the region.

Someone has asked a similar question at http://forum.ocrsdk.com/questions/1498/fr10-engine-how-to-only-recognize-specified-region-of-the-image, but that applies for images and c#. I need to know if it works with PDF documents as well and for C++.

My attempts to port the answer to C++ for the above question has failed so possible solutions are welcomed. I have tried to incorporate the changes in the Hello sample provided with FR11 Enginge.

TIA Johan

asked 03 Sep '14, 10:03

johan's gravatar image


Hi Johan,

Hope the code snippet below will help you.

C++ sample:

// Add image file to document
frDocument->AddImageFile( imagePath, 0, 0 );

// Remove all the blocks from the collection
FREngine::IFRPagesPtr frPages;
frDocument->get_Pages( &frPages );
// Select the first page of your input pdf document
FREngine::IFRPagePtr frPage = frPages->Item( 0 ); 
FREngine::ILayoutPtr layout;
frPage->get_Layout( &layout );
FREngine::ILayoutBlocksPtr  blocks;
layout->get_Blocks( &blocks );

// Create region and specify its coordinates
FREngine::IRegionPtr region = Engine->CreateRegion();
region->AddRect( Left, Top, Right, Bottom );

// Add blocks of required type to the layout
FREngine::IBlockPtr block = blocks->AddNew( FREngine::BT_Text, region, 0 );

// Set the required parameters of the block
FREngine::IRecognizerParamsPtr recognizerParams = Engine->CreateRecognizerParams();
recognizerParams->SetPredefinedTextLanguage( L"English" );
FREngine::ITextBlockPtr textBlock = block->GetAsTextBlock();
textBlock->put_RecognizerParams( recognizerParams );

//Recognize document
frDocument->Recognize( 0, 0 );
This answer is marked "community wiki".

answered 05 Sep '14, 12:20

Natalia%20Karaseva's gravatar image

Natalia Kara...

wikified 05 Sep '14, 12:49

SDK_support's gravatar image

SDK_support ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 03 Sep '14, 10:03

Seen: 3,498 times

Last updated: 05 Sep '14, 12:49

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal