How to get word coordinates from the document

Question

Is it possible to receive the word coordinates instead of character coordinates in FineReader Engine 12?

Answer

You can get coordinates of the word using the Region property. Here is a sample code in C#, that iterates through all found words in the block and saves their coordinates:

FREngine.IBlock block;
// Iterates paragraphs of a text block and retrieves the text
FREngine.ITextBlock textBlock = block.GetAsTextBlock();
int paragraphsCount = textBlock.Text.Paragraphs.Count;
for (int iPar = 0; iPar < paragraphsCount; iPar++)
{
FREngine.IParagraph par = textBlock.Text.Paragraphs[iPar];
int wordsCount = par.Words.Count;
for (int iWord = 0; iWord < wordsCount; iWord++)
{
FREngine.IWord word = par.Words[iWord];
int top = word.Region.Top
int bot = word.Region.Bottom
int l = word.Region.Left
int r = word.Region.Right
//Do something with top, bottom, left, right coordinateds of word
}
}

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.