I want to customize Edit-Text functionality pragmatically

WebViewer Version: 8.9.0

Do you have an issue with a specific file(s) - NO
Can you reproduce using one of our samples or online demos - NO
Are you using the WebViewer server - NO
Does the issue only happen on certain browsers - NO
Is your issue related to a front-end framework - YES
Is your issue related to annotations - Maybe

Please give a brief summary of your issue:
I want to customize Edit-Text functionality pragmatically.

Please describe your issue and provide steps to reproduce it:
I want to show a pop-up screen when a user click on edit-text button, and pause the editing functionality till user press “YES” and cancel the editing functionality when user press “NO” on pop-up screen.

Hi gautam,

Thank you for contacting WebViewer Forums Support,

If you would like to show a popup when a user clicks a button, you can do so with the custom modal guide:

From there, you can choose to enable/disable elements/tools:

Best Regards,
Kevin Kim

  1. Sorry for not being thorough. What I want is to stop the edit-text functionality on click of the “EDIT TEXT” ribbon/button and open a popup and resume the “Edit Text” functionality when the user clicks on “Yes” which is present in the popup screen.

Right now I am able to open a popup but as soon as I click on the “Edit Text” ribbon/button the js is running behind the scenes and making the document editable. I want to prevent this process and customize it. Is it possible?

  1. I want to limit FileTypes(pdf, docx, xlsx. ppt) on click of “Open File” button. What I want is to only open pdf files when a user clicks on “Open File” button.

Hi gautam,

Thank you for your clarification,

  1. If you have the content edit mode enabled, you can use the contentEditManager class to control the contentEditMode:
    PDFTron Systems Inc. | Documentation
    PDFTron WebViewer Class: ContentEditManager
    You can use startContentEditMode & endContentEditMode to toggle this mode on and off.

  2. If you use loadAsPDF:true in the WebViewer constructor, then content edit mode can still work for office files. If you wish to only allow PDF files to be loaded to WebViewer, you may have to try different methods as that part of the UI is outside of WebViewer’s scope.
    Potential solution using ‘accept’ attribute: html - Limit file format when using <input type="file">? - Stack Overflow

Best Regards,
Kevin Kim