Deselect programmatically annotation in sfpdfViewer

Hello, 

It is possible to deselect annotation programmatically in sfpdfViewer ? I didn't found anything related with that in the documentation. 

16 Replies

AV Ashokkumar Viswanathan Syncfusion Team April 17, 2020 07:11 AM UTC

Hi Rayhane, 
 
At present, we do not have the support to deselect the Annotation programmatically. Could you please explain briefly about your use case scenario? It will be useful for us to investigate further on this and assist you with a better solution at the earliest.  
 
Regards, 
Ashok Kumar Viswanathan. 



RA Rayhane April 17, 2020 12:07 PM UTC

Thank you to answer me, 

In my case when I select an annotation (for example a shape), a bottom toolbar is poping up to change the current shape color, thickness, selected. But If I want to click on the back button located in this current toolbar, to return on my main bottom toolbar annotation tools or previous toolbar menu. My shape is still detected and I can't remove the actual selected annotation. 

I upload images showing the scenario require in my case, It is the same scenario than the built-in toolbar. Wich mean that when I click on the back arrow button the current selected annotation will be deselected after cliking on the back button. 

Tell me If you need more details. 




Attachment: Desktop_fc04faf7.zip


AV Ashokkumar Viswanathan Syncfusion Team April 20, 2020 12:23 PM UTC

Hi Rayhane, 
 
At present, we do not have the support to deselect the Annotation programmatically. We do not have any immediate plans to implement this support. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest.  
 
Please track the status of the implementation from below link, 
 
Based on our present commitments and the above parameters, this feature is expected to be implemented in our 2020 Volume 3 main release. We will let you know when this feature is implemented.  
 
Disclaimer: The date for the feature implementation is tentative and not a commitment on our parts. 
 
Please let us know if you need further assistance. 
 
Regards, 
Ashok Kumar Viswanathan. 



RA Rayhane April 20, 2020 02:08 PM UTC

Hi, 

Thank you !


RA Rayhane April 21, 2020 11:54 AM UTC

Hello, 

I'm facing a new issue related to this one. 

Indeed to get around that, I implemented a popup instead of a bottom bar, where I place all my control to edit the select annotation. Howewer If I want to place my popup just above the rectangle bounds and centered horizontally the rendering isn't correct. 

For example : 

private void PdfViewerControl_InkSelected(object sender, InkSelectedEventArgs args)
        {
            //Get the bounds
            Rectangle bounds = args.Bounds;

            popupAnnotationTools.SfPopupLayout.StaysOpen = true;

            popupAnnotationTools.SfPopupLayout.Show(bounds.center.X - (popupWidth/2) , (lastRectangleBounds.Center.Y - (popupHeight/2));

            //Casts the sender object as Ink annotation.
            selectedInkAnnotation = sender as InkAnnotation;
        }

I tried to debug and for a simple test I found : 

bounds.center.x = 543
bounds.center.x = 711

Wich is incorrect because the actual screen width of my device emulator is 300. 

The bounds value seems incorrect 

I tried different calculations but I can't found a way to make the bounds proportional.


AV Ashokkumar Viswanathan Syncfusion Team April 22, 2020 03:07 PM UTC

Hi Rayhane,  
 
Based on the provided information, we suspect that you have been using the bounds from the InkSelectedEventArgs to add the popup view over the selected Annotation at particular position in the view port. However, bounds from the InkSelectedEventArgs will gives actual position and size of the annotation with respect to the page only. For example if we add a ink Annotation in third page, bounds for the ink Annotation will be considered with respect to the third page, not based on the view port of the application. 
 
Could you please explain briefly about your requirement to add popup view over the selected Annotation? It will be useful for us to investigate further on this and assist you with a better solution at the earliest.    
 
Regards, 
Ashok Kumar Viswanathan. 



RA Rayhane April 27, 2020 09:19 PM UTC

Thank you for your reply 

I want to center a popup horizontally just above the annotation when this one is selected, but without page size info it seems impossible. 

I uploaded a simple image to show. 

Attachment: Capture_2b4e8711.rar


AV Ashokkumar Viswanathan Syncfusion Team April 28, 2020 11:52 AM UTC

Hi Rayhane, 
 
Based on your requirement mentioned in your last update, we have created a simple sample to show popup view when Annotation is selected. 
 
Please find the sample in the below link, 
 
Please try the above sample, confirm whether the provided solution has resolved your issue. 
 
Regards, 
Ashok Kumar Viswanathan. 



RA Rayhane April 28, 2020 09:33 PM UTC

Hello, Thank you ! 

Howewer my main problem is that I struggle to center horizontally a popup depending the selected annotation, 

I upload a better example showing my requirement. 

Attachment: Example_26524a86.rar


AV Ashokkumar Viswanathan Syncfusion Team April 29, 2020 02:04 PM UTC

Hi Rayhane, 
 
Based on your requirement to place a popup view horizontally center over the selected annotation, we need to get the PDF page bounds to calculate the bounds of the selected annotation with respect to the view port of the SfPdfviewer control. At present, we do not have the support to get the  bounds of the selected annotation with respect to the view port. We will analyze the feasibility for this support and we will update the further details on 6th May 2020. 
 
Regards, 
Ashok Kumar Viswanathan. 



RA Rayhane April 29, 2020 02:22 PM UTC

Thank you !


AV Ashokkumar Viswanathan Syncfusion Team May 6, 2020 02:21 PM UTC

Hi Rayhane,  
 
Sorry for the inconvenience.  
   
We are still analyzing the feasibility for the support to get the  bounds of the selected annotation with respect to the view port, as it requires much deeper analysis and we will update further details on 8th May 2020 without any delay.  
 
Regards, 
Ashok Kumar Viswanathan. 



RA Rayhane May 6, 2020 09:41 PM UTC

Ok, thank you for the update 


AV Ashokkumar Viswanathan Syncfusion Team May 8, 2020 12:04 PM UTC

Hi Rayhane, 
   
At present we do not have support to “Expose the bounds of the annotations with respect to view port”. We do not have any immediate plans to implement this feature. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest.      
       
Based on our present commitments and the above parameters, this feature is expected to be implemented in our 2021 Volume 1 main release. We will let you know when this feature is implemented.     
    
Disclaimer: The date for the feature implementation is tentative and not a commitment on our parts.      
      
You can now track the status of this feature request here,           
   
 
Regards, 
Ashok Kumar Viswanathan. 



RA Rayhane May 11, 2020 11:45 AM UTC

Thank you for your time 


PN Preethi Nesakkan Gnanadurai Syncfusion Team May 12, 2020 12:49 PM UTC

Hi Rayhane, 
  
Most welcome. 
  
Regards, 
Preethi 


Loader.
Up arrow icon