How to get word coordinates from the document


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


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

Have more questions? Submit a request



Please sign in to leave a comment.