We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

iOS Negatives Coordinates

Thread ID:

Created:

Updated:

Platform:

Replies:

140678 Oct 31,2018 12:30 PM UTC Nov 5,2018 11:46 AM UTC Xamarin.Forms 3
loading
Tags: PdfViewer
laura
Asked On October 31, 2018 12:30 PM UTC

Recently I used the pdf controls and I got something weird with iOS coordinates. Using the below function in an Android device I got the correct coordinates, but if I use an iOS device the coordinates aren't the same. For example, using Android device I got 

{{X=177.4717,Y=227.54,Width=66.04127,Height=11.04}}

and using iOS device:

{{X=17747,17,Y=-6047,08,Width=6604,129,Height=1104}}.

X, Width and Height are 100 times the same but Y coordinate doesn't make sense for me. It's a negative coordinate and I couldn't find the relationship with the others.

How do you get the Y coordinate in a iDevice?

Hope you can help me.


Regards.



        public static MemoryStream HighLightPdf(this byte[] bytes, Dictionary<string, IList<string>> words)
        {
            Color color = Color.Yellow;

            PdfLoadedDocument doc = new PdfLoadedDocument(bytes);
            Dictionary<int, List<RectangleF>> matchRect = new Dictionary<int, List<RectangleF>>();

            foreach (var key in words.Keys)
            {
                if (key == "Locations")
                    color = Color.Blue;
                else if (key == "Organizations")
                    color = Color.Red;
                else if (key == "People")
                    color = Color.Green;

                foreach (var word in words[key])
                {
                    var matched = doc.FindText(word, out matchRect);
                    if (matched)
                    {
                        foreach (KeyValuePair<int, List<RectangleF>> item in matchRect)
                        {
                            PdfLoadedPage page = doc.Pages[item.Key] as PdfLoadedPage;
                            foreach (var rect in item.Value)
                            {

                                PdfTextMarkupAnnotation textannot = new PdfTextMarkupAnnotation(newRect);
                                textannot.TextMarkupAnnotationType = PdfTextMarkupAnnotationType.Highlight;
                                textannot.TextMarkupColor = new PdfColor(color);
                                page.Annotations.Add(textannot);
                            }
                        }
                    }
                }
            }
            MemoryStream memStream = new MemoryStream();
            doc.Save(memStream);
            return memStream;
        }

Karthik Krishnaraj [Syncfusion]
Replied On November 1, 2018 02:23 PM UTC

Hi Laura, 
 
Greetings from Syncfusion, 
 
We were unable to reproduce the issue with provided information. We are getting the coordinate value of searched text same as in android. I have attached a sample which we tried in our side. Can you please modify the sample to replicate the issue and share with us? It will be helpful for us to analyze further and provide better solution. 
 
Sample Link: 
 
Regards, 
Karthik. 


laura
Replied On November 2, 2018 08:59 AM UTC

We've tested the program on the emulator and on the devices and the results obtained were different. When testing on the emulator, coordinates are correct but trying it on the device, either Android or iOS,  coordinates are wrong.

Dilli Babu Nandha Gopal [Syncfusion]
Replied On November 5, 2018 11:46 AM UTC

Hi Laura, 

We are afraid that we are unable to reproduce the issue “Bounds of the specified text is not approximate in emulator and device” while deploying the application in Xamarin.Forms Android and Xamarin.Forms iOS. We suspect that the issue is specific to the PDF document. So, we request you to share us the PDF document with which the issue could be reproduced. 
  
Note: If you have any confidential data in your PDF document, please replace with some dummy data and provide us the same. Kindly check whether the issue is reproduced with this document We just need your document to recreate the problem you face. 
 
Also provide the following details which will help us to reproduce the issue, 

  1. Device details (Android/iOS) with model name 
  2. Syncfusion Essential Studio 
  3. Device culture information 
  4. Issue reproducing sample 

Please let us know if you have any questions. 

Regards, 
Dilli babu. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;