Getting two characters from pdf document with mouse coordinates using Aspose.Pdf.Text

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)

@kirangali

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input PDF.
  • Please attach the output PDF file that shows the undesired behavior.
  • Please attach the expected output PDF file that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi Team,

Please find attached input pdf file, output, Expected output and standalone console application which was shared by attached link to reproduce the issue.

Note: While accessing link if you are unable to download, please request access to download the console App.

Input Pdf File.pdf (149.3 KB)
Annotate 2 Wrong Result (Getting two characters(Ma) but excepted result is one Character(M) ).png (33.6 KB)
Annotate 3 Correct Result(Getting one Character (t) based on mouse corordinates.png (28.7 KB)

@kirangalifreyr

The link to download the console application requires login. Can you please share the link than can be accessed publicly?

Hi team,

Please click on below link to download the Standalone Console Application to reproduce the issue.

https://we.tl/t-LQ4L3ctUih

Thanks,
Kiran G

@kirangalifreyr

We are checking it and will get back to you shortly.

@kirangalifreyr

We have logged an issue as PDFNET-53191 in our issue tracking system for the sake of further investigation and rectification. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Could you please update the current status?

@kirangalifreyr

The ticket has recently been logged in our issue tracking system and it is pending for initial analysis. We will surely resolve it on a first come first serve basis and inform you once we have some news about its resolution. Please spare us some time.

We are sorry for the inconvenience.