Hi Team,
Two characters are getting in some words of pdf document With mouse coordinates
Please find below sample code for reference.
decimal? height = s.height;
decimal? width = s.width;
decimal? xValue = s.x;
decimal? yValue = s.y;
decimal? CHeight = s.CHeight ?? 0;
decimal? CWidth = s.CWidth ?? 0;
var pageRectangle = document.Pages[s.pageNumber ?? 0];
var rectRectangle = annotationsOnpdfAspose.GetRectangle(document, (float)xValue, (float)yValue-(float)1.0, (float)(width+2), (float)(height+3), (float)CHeight, (float)CWidth, s.pageNumber ?? 0, pageRectangle.Rotate);
TextFragmentAbsorber ta = new TextFragmentAbsorber();
ta.TextSearchOptions = new TextSearchOptions(rectRectangle);
ta.Visit(pageRectangle);
if (ta.TextFragments.Count != 0)
{
foreach (TextFragment tf in ta.TextFragments)
{
if (!string.IsNullOrEmpty(tf.Text.Trim()))
{
var font = tf.TextState.Font.FontName;
var fontSize = tf.TextState.FontSize;
var fonts = new TextFontProp
{
font = font,
size = fontSize,
text = tf.Text,
};
textFontProps.Add(fonts);
}
}
}
Thanks & Regards,
Kiran GFontInfo1.PNG (19.8 KB)