Having trouble getting help?
Contact Support
Contact Support
Disable the annotations selection
21 Jan 20251 minute to read
PDF Viewer allows you to enable or disable the annotations selection using the Constraints
property programmatically. The following code snippet illustrates disabling the selection of the exsisting and newly added freetext annotations in the PdfViewer.
// Trigger the DocumentLoaded event of the PdfViewerControl.
pdfViewer.DocumentLoaded += PdfViewer_DocumentLoaded;
private void PdfViewer_DocumentLoaded(object sender, EventArgs args)
{
// Disable the selection of the free text annotations.
pdfViewer.FreeTextAnnotationSettings.Constraints = ~AnnotationConstraints.Selectable;
}
' Trigger the DocumentLoaded event of the PdfViewerControl.
AddHandler pdfViewer.DocumentLoaded, AddressOf PdfViewer_DocumentLoaded
Private Sub PdfViewer_DocumentLoaded(ByVal sender As Object, ByVal args As EventArgs)
' Disable the selection of the free text annotations.
pdfViewer.FreeTextAnnotationSettings.Constraints = Not AnnotationConstraints.Selectable
End Sub
NOTE
- Similarly, you can disable the selection for all other annotations.
- If you disable/enable the annotations selection after the document is loaded, the changes will only be reflected in the newly added annotations.