iOS - How to programmatically select a signature(with AnnotEditTool)

Hi there,
We are adding a signature to a PDF document, once this signature is added, it needs to be programmatically selected with the AnnotEditTool( in order for the user to place it in the exact position on the document).

The only way I have found so far, seems to be to simulate a UITapGestureRecognizer at the coordinates for the signature/annotation. I do not like this approach as it seems ‘hack-y’

Is there an easier way to accomplish this?
Thank you
Morne

The Annotation will have been appended to the existing annotations on that page. So you once the tool has added it to the page, you can access it this way.

`
page = doc.GetPage(x)
sig_annot = page.GetAnnot(page.GetNumAnnots() - 1) # probably want to double check that there is at least 1 annot…

`

Hi Morne,

What Ryan replied is true for accessing a PDF annotation in code, but I believe you are asking how to programmatically trigger a visual selection of an annotation. Unfortunately there isn’t currently a built-in mechanism to do this, so your choices would be to use the ‘hacky’ approach, or to modify the tools code to create a proper way of doing this. The latter will be nicer to use internally, but will make merging in new versions of the tools source code more time consuming. (It is best to subclass when possible.)

That said, having a standard programmatic way to visually select an annotation sounds like a good idea, so we’ll try to add this to a future version.

Thanks guys,

No problem, I will use the simulation of a gesture recogniser for now and look out for when you add it to the SDK.

Regards,
Morne