Hilario Goes
Hilario Goes

Reputation: 453

Freetext tool in PDFTron focusout()

I use PDFTron for an internal website. When I click the Free text tool in PDFTron it works fine. What I need is that on focusout() of the text tool I need the Pan tool to be selected.

Can anyone guide me on how do I go about doing that?

Upvotes: 1

Views: 176

Answers (1)

mparizeau
mparizeau

Reputation: 663

Can you clarify what you mean by focusout of the FreeText tool? Do you mean after you create the FreeText annotation it will switch to the Pan tool?

Here is how you could switch to it after creating a FreeText annotation:

const { docViewer } = instance;

const freeTextTool = docViewer.getTool('AnnotationCreateFreeText');

// note that in WebViewer 5.2 you need to add the "e" parameter like: 
// (e, annotation) => {
freeTextTool.on('annotationAdded', (annotation) => {
  setTimeout(() => {
    instance.setToolMode('Pan');
  }, 0);
});

Upvotes: 1

Related Questions