Disable the context menu in ASP.NET Core PDF Viewer
28 Feb 20261 minute to read
Prevent users from accessing the context menu by setting the ContextMenuOption property to 'None'. This hides all context menu options on right-click. The default value is 'RightClick'.
Use the following example to disable the context menu in the PDF Viewer:
<div style="width:100%;height:600px">
<ejs-pdfviewer id="pdfviewer"
style="height:600px"
documentPath="https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf"
resourceUrl="https://cdn.syncfusion.com/ej2/31.1.17/dist/ej2-pdfviewer-lib"
contextMenuOption="None">
</ejs-pdfviewer>
</div><div style="width:100%;height:600px">
<ejs-pdfviewer id="pdfviewer"
style="height:600px"
documentPath="https://cdn.syncfusion.com/content/pdf/form-filling-document.pdf"
serviceUrl="/api/PdfViewer"
contextMenuOption="None">
</ejs-pdfviewer>
</div>This configuration hides the context menu entirely, preventing users from accessing it when right-clicking on the PDF document.