Disable context menu option in EJ2 TypeScript Pdfviewer control

8 May 20231 minute to read

To disable the context menu in the Syncfusion PDF viewer control, you can use the ContextMenuOption property as 'None' to hide all context menu options. Default value of the ContextMenuOption is 'RightClick'.

Here is an example of how you can use the ContextMenuOption to disable context menu in the PDF Viewer:


<button id='disable'>Disable ContextMenuOption</button>

// Disable ContextMenuOption
document.getElementById('disable').addEventListener('click', ()=> {
  viewer.contextMenuOption = 'None';
});

This will hide the context menu and prevent the user from right-clicking on the PDF viewer.

Find the sample how to disable context menu