im using CharParams and Paragraphs api but i have problem i can't extract the coordinate of each words i only get the coordinate of each charaters
i need help Thank you.
Here is my code (C#)
// Iterate layout blocks
FREngine.Layout layout = document.Pages[0].Layout;
for (int i = 0; i < layout.Blocks.Count; i++)
{
if (layout.Blocks[i].Type == FREngine.BlockTypeEnum.BT_Text)
{
FREngine.CharParams charParams = engineLoader.Engine.CreateCharParams();
FREngine.Paragraphs paragraphs = layout.Blocks[i].GetAsTextBlock().Text.Paragraphs;
// FREngine.Paragraphs paragraphs = layout.Blocks[i].GetAsTextBlock().Text.TextOrientation;
for (int p = 0; p < paragraphs.Count; p++)
{
for (int j = 0; j < paragraphs[p].Length; j++)
{
paragraphs[p].GetCharParams(j, charParams);
FREngine.WordRecognitionVariants wordVariants = charParams.WordRecognitionVariants;
if (wordVariants != null)
{
for (int k = 0; k < wordVariants.Count; k++)
{
FREngine.WordRecognitionVariant wordVariant = wordVariants[k];
string word = wordVariant.Text;
double x1 = charParams.Left * 72/96;
double x2= charParams.Right*72/96;
double y1= charParams.Bottom*72/96;
double y2= charParams.Top*72/96;
Console.WriteLine(word);
}
}
}
}
}
}
Comments
1 comment
You can use the Region field of the Word object, it contains the bounding rectangle of the word.
Please sign in to leave a comment.