How to control what happens with a newly created signature

Product: WebViewer

Product Version: 8.0.1

Please give a brief summary of your issue:

I want to open the signature tool when the user clicks a button, which I know that I can do via tool.trigger('locationSelected').

Once the signature is created however, I want to override PDFTron’s default behavior which is to create a ghost element of the signature, that follows the user’s cursor around until the user clicks on the document (at which point the signature is dropped onto that location).

Is there any way to prevent the ghost-element-click-and-drop thing, so that I can control where the newly created signature is placed on the page?

I tried doing this:

tool.trigger('locationSelected', [
				pageIndex: 0,
				x: 10,
				y: 10,

thinking that it would replace the widget (which is a SignatureWidgetAnnotation) with the signature. But it didn’t seem to make any difference.


The solution around this involves tricking the tool that it has a location already. You can do that by setting the location on the tool or triggering the mouseLeftUp function on the tool with a proper mouse event. The first is easier to do but I thought I’d leave an alternative:

const tool = instance.Core.documentViewer.getTool(instance.Core.Tools.ToolNames.SIGNATURE)
tool.location = {
    pageNumber: 1,
    x: 10,
    y: 10,

Let me know if this helps!

Worked like a charm. Thank you!