How to track changes (e.g. FontColor) of annotations?

I want to keep track of changes that the user makes to annotation settings such as font color, etc. so that these are the defaults the next time the user uses the app.  There is no callback to know when the user made a change in the annotations toolbar.  Changes on the toolbar are not reflected in the settings such as FreeTextSettings. There is AnnotationPropertiesChanged event, but that does not give me direct access to the particular annotation that changed.

What do you think the best approach is to know when annotation properties have changed and what the current properties are of the selected annotation?

Thanks,

Arthur


9 Replies

VS Vasugi Sivajothi Syncfusion Team October 5, 2021 08:14 AM UTC

Hi Arthur, 
 
Thank you for contacting Syncfusion support. 
 
The FreeTextSettings module is used to provide the properties to free text annotation. But you can get the particular annotation while changing the annotation properties using the AnnotationId in the AnnotationPropertiesChanged event. Please refer to the below code snippet and screenshot. 
 
Code Snippet: 
 
<SfPdfViewerServer @ref="Viewer" DocumentPath="@DocumentPath" Height="640px" Width="100%"> 
    <PdfViewerEvents AnnotationPropertiesChanged="@AnnotationPropertiesChanged"></PdfViewerEvents> 
</SfPdfViewerServer> 
 
    private void AnnotationPropertiesChanged(AnnotationPropertiesChangeEventArgs args) 
    { 
       string Id = args.AnnotationId; 
    } 
 
   
  
Kindly try this and let us know if this suits your requirement. If not, please share more details about your requirement. This will be helpful to investigate further and provide the solution at the earliest. 
 
Regards, 
Vasugi. 



AB Arthur Butler October 5, 2021 08:34 AM UTC

OK, how do I go from the AnnotationId to an actual Annotation object that I can query its properties?

Thanks,

Arthur



VS Vasugi Sivajothi Syncfusion Team October 6, 2021 10:40 AM UTC

Hi Arthur,  
 
You can get the actual annotation details from annotation collection using the annotationId. Please refer to the below code snippet and sample. 
 
Code Snippet: 
 
private async void AnnotationPropertiesChanged(AnnotationPropertiesChangeEventArgs args) 
    { 
        Id = args.AnnotationId; 
        var annotationCollection = await Viewer.GetAnnotations(); 
        for (var i = 0; i < annotationCollection.Count; i++) 
        { 
            if (annotationCollection[i].Id == Id) 
            { 
                object annotation = annotationCollection[i]; 
            } 
        } 
    } 
 
 
 
Kindly try this and let us know if this suits your requirement. If not, please share more details about your requirement. This will be helpful to assist you better. 
 
Regards, 
Vasugi.  



AB Arthur Butler November 28, 2021 10:33 AM UTC

This does give me the particular annotation.  However, for Highlight, Underline, and Strikethrough annotations, the value of annotation.Color is not correct in  AnnotationPropertiesChanged when I change the color of the annotation in the toolbar.



VS Vasugi Sivajothi Syncfusion Team November 29, 2021 01:10 PM UTC

Hi Arthur,  

We were able to reproduce the reported issue “Color is not updated properly in the annotation collection when changing the text markup annotation color”.  We will analyze further on this and update you with more details on December 1, 2021. 

Regards, 
Vasugi. 



VS Vasugi Sivajothi Syncfusion Team December 1, 2021 11:37 AM UTC

Hi Arthur,   
 
We have confirmed that the reported issue “Annotation color is not updated properly in the annotation collection when changing the text markup annotation color” is a defect and logged the defect report for the same. The fix for this issue will be included in our upcoming weekly nuget release on  22nd  December 2021.  
  
You can track the status using the below feedback link. 
 
Regards, 
Vasugi. 



VS Vasugi Sivajothi Syncfusion Team December 22, 2021 12:04 PM UTC

Hi Arthur,    
 
Due to volume 4 main release on last week Friday, this week we do not have a weekly release. We will provide the fix in our upcoming weekly NuGet release on December 29, 2021. 
 
 
Regards, 
Vasugi. 
 



VS Vasugi Sivajothi Syncfusion Team December 29, 2021 01:31 PM UTC

Hi Arthur,   
 
Sorry for the inconvenience. The fix was not included in our latest weekly NuGet release due to the technical issues. However, we have shared the custom package for the same. We will include this fix in our upcoming weekly NuGet release on 5th January 2022.  
 
Note: Update the pdfviewer nuget in 19.4.40 version and replace the above attachments scripts in the below location or install the custom nuget from the above link. Then build and run the sample. 
 
Location: Username\.nuget\packages\syncfusion.blazor.pdfviewer\19.4.0.40\staticwebassets\scripts\ 
 
Regards, 
Vasugi. 



DM Dhivyabharathi Mohan Syncfusion Team January 5, 2022 12:25 PM UTC

Hi Arthur, 

 
The fix was included in our latest weekly NuGet release v19.4.0.41. Kindly upgrade to that version to get the issue resolved. 

 
Packages:    
 
Blazor Client       
Blazor Sever      
Service side package         
ASP.NET Core :         
ASP.NET MVC:         


 


 


 
Regards, 
Dhivya. 


Loader.
Up arrow icon