How to disable edition and annotating the PDF file based on some codition

Hi, 
I am using a PDFViewer control in one of my Xamarin.Android app. 
I have a scenario, where in some condition, I want to disable editing and annotating PDF files.

I have used the following code to disable the toolbar, so that they can add the annotations
             if (IsJobFinished)
            {
                viewer.Toolbar.Enabled = false;
                viewer.IsTextSelectionEnabled = false;
            }
            else
            {
                viewer.Toolbar.Enabled = true;
                viewer.IsTextSelectionEnabled = true;
            }

This is correctly hiding the toolbar so the user is not able to add any annotation if the "IsJobFinished" flag is true. But the user still be able select any existing annotation like inking, text , shapes etc. and resize them or move them to another location on the PDF

Could you please help me out with this? I don't want any operations to be performed on the PDF once "IsJobFinished" flag is true, the user can only view the PDF document in that case.

1 Reply 1 reply marked as answer

MK Muralitharan Karikalan Syncfusion Team February 8, 2021 12:21 PM UTC

Hi Simon, 
 
We can enable or disable the annotations interactions using IsLocked property. 
 
Please find the code snippet below, 
 
 
//Annotation interactions will be disabled when the property is set to true. Default value false.  
pdfViewer.AnnotationSettings.IsLocked = true; 
 
 
 
Regards, 
Muralitharan K  


Marked as answer
Loader.
Up arrow icon