Page 1 of 1

Unable to get FocusedAnnotationView from annotation with ReadOnly flag set

Posted: Fri Feb 14, 2020 9:22 pm
by IntegraHarlan
Hi,
I am trying to get the properties of an annotation to display in a dialog. I can do this by getting the FocusedAnnotationView from the PdfAnnotationTool on a mouse click event.
However, when the annotation is marked as ReadOnly, The FocusedAnnotaionView is null.
Is there a way I can select a ReadOnly annotation so I can read the properties?
I am using the Winforms .Net plugin.

Thanks
Harlan

Re: Unable to get FocusedAnnotationView from annotation with ReadOnly flag set

Posted: Mon Feb 17, 2020 12:25 pm
by Alex
Hi Harlan,

The PdfAnnotationTool class does not allow to interact with read-only annotation in Markup or View interaction modes. Also read-only annotation cannot be set as focused annotation in Markup or View interaction modes.

In version 9.0.0.17, which will be released this week, we will add the PdfAnotationTool.FindAnnotationView(X,Y) method, which will allow to find any annotation in specified location on image.

Here is code snippet that shows how to find annotation in mouse location:

Code: Select all

//...
// subscribe to the AnnotationTool.MouseClick event
_annotationTool.MouseClick += PdfAnnotationTool_MouseClick;
//...

/// <summary>
/// Mouse is clicked on image in image viewer.
/// </summary>
private void PdfAnnotationTool_MouseClick(object sender, VisualToolMouseEventArgs e)
{
    // get the mouse position
    Point mousePosition = e.Location;
    // find annotation view in mouse location
    PdfAnnotationView view = _annotationTool.FindAnnotationView(mousePosition.X, mousePosition.Y);
    //...
}
Best regards, Alexander