Disable context menu in ASP.NET MVC PDF Viewer control
28 Oct 20251 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:
<div id="e-pv-e-sign-pdfViewer-div">
@Html.EJS().PdfViewer("pdfviewer").DocumentPath("https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf").ContextMenuOption(Syncfusion.EJ2.PdfViewer.ContextMenuAction.None).Render()
</div><div id="e-pv-e-sign-pdfViewer-div">
@Html.EJS().PdfViewer("pdfviewer").ServiceUrl(VirtualPathUtility.ToAbsolute("~/PdfViewer/")).DocumentPath("https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf").ContextMenuOption(Syncfusion.EJ2.PdfViewer.ContextMenuAction.None).Render()
</div>This will hide the context menu and prevent the user from right-clicking on the PDF viewer.