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. Image for the cookie policy date

Using Holding event to check if we are doing a Long Press over a PdfPopupAnnotation

I've been trying to use the Holding event on a SfPdfViewerControl to see if i could get a way of intereacting with PdfPopupAnnotation
my idea is to get the coordinates on the Holding event and trying to compare it someway with the annotations location.
so lets say we have this document bellow: (i use PageViewMode.FitWidth).

The blue rectangle represents what im seeing on the tablet.
The red Square represents a annotation, and hold where i do a long press, triggering the Holding event.
the pdf document has a page size of 1165px according to adobe acrobat reader, and 841.89 according to pdfDocument.Pages[0].Size.Height.
i also know that annotations coordinates consider bottom left corner of the pdf as X=0 and Y=0
and that the Holding event coordinates consider the top left of the as X=0 and Y=0

with all that said my questions are
is there a way to detect tapping/long press or any sort of interaction with PdfPopupAnnotations ?
if not, what sort of calculations would i need to find out when i press on top of a PdfPopupAnnotation with the holding event?
im guessing it the page height minus some sort of horizontal offset to compensate the scrolldown and minus the Y coordinate of the holding event
but im not getting quite the expected results.


thanks

6 Replies

SS Sathish Sivakumar Syncfusion Team April 28, 2015 01:46 PM UTC

Hi Ric,

We have created the sample to interact with PdfPopupAnnotation where you can get the coordinates using Holding event and comparing the coordinates with annotation location. Please find the sample in the following location:

https://www.syncfusion.com/downloads/support/forum/118934/PopupAnnotation-488521804.zip

Here our sample displays the pop up message box when you hold by touch or left clicked with the mouse on the Popup annotation.

Please let us know if you have any concerns on this.

Regards,

Sathish S.



RS Ric Silva April 29, 2015 09:33 AM UTC

Thanks, ill check it out


SS Sathish Sivakumar Syncfusion Team May 4, 2015 04:27 AM UTC

Hi Ric,

Thank you for your update.
We will wait to hear from you.

Regards,

Sathish Sivakumar


RS Ric Silva May 13, 2015 02:19 PM UTC

sorry for late reply

i was checking your sample and im confused about this part on the OpenFile method

for (int i = 0; i < m_loadedDocument.Pages.Count;i++ )
            {
                annots = m_loadedDocument.Pages[i].Annotations;
            }

wont that load only the annotations from the last page?

later here

 private void RenderPopupBounds(PdfLoadedAnnotationCollection annots)
        {
          annotationBounds = new System.Drawing.RectangleF[annots.Count];
          for(int i=0;i<annots.Count;i++)
          {
              PdfLoadedPopupAnnotation annotPopup = annots[i] as PdfLoadedPopupAnnotation;
              if (annotPopup != null)
              {
                  annotationBounds[i] = (annotPopup).Bounds;
              }
          }
        }

it will only save the bounds of the annotations of that last page, or im i understand it wrong? 



i tried something like this
for (int i = 0; i < pdfDocument.Pages.Count; i++)
                {
                    if (annots == null)
                    {
                        annots = pdfDocument.Pages[i].Annotations;
                    }
                    else
                    {
                        foreach (PdfLoadedAnnotation item in pdfDocument.Pages[i].Annotations)
                            annots.Add(item);
                    }
                    
                }

and it saved all annotations, but i have a problem with the pages, since the Y coordinates are relative to the page, so its it allways between 0 and 768ish, so if i want to compare coordinates of annotations on pages above 0 i have to add a Y offset  ( i assume)




RS Ric Silva May 13, 2015 03:10 PM UTC

I used the PageChanged event to load the annotations of that page to the annots variable, so far seems to be working


DG Deepak Gunasekaran Syncfusion Team May 14, 2015 10:10 AM UTC

Hi Ric,

Thanks for the update.

We are happy to hear that your issue is resolved.

Please let us know if you need further assistance.

Regards,
Deepak G


Loader.
Live Chat Icon For mobile
Up arrow icon