How to hide the toolbar items from the PDF Viewer toolbar in .NET Core?
Show or Hide toolbar items from the PDF Viewer toolbar
You can show or hide the toolbar items from the PDF Viewer in ASP.NET Core in the following ways:
- During runtime with the showToolbarItem method dynamically.
- During control initialization with the toolbarSettings property.
List of available toolbar items:
The toolbar items are identified using the ToolbarItem property:
- OpenOption
- PageNavigationTool
- MagnificationTool
- PanTool
- SelectionTool
- SearchOption
- PrintOption
- DownloadOption
- UndoRedoTool
- AnnotationEditTool
You can get the string names for the list of available menu items in the toolbar using the ToolbarItem property. With that toolbar item, showing/hiding the toolbar icons can be achieved by using the showtoolbaritem method.
Refer to the following code example to hide the Open icon during control initialization.
JavaScript
<ejs-pdfviewer id="container" style="height:600px" serviceUrl="/api/PdfViewer" documentPath="PDF_Succinctly.pdf" toolbarSettings="@(new Syncfusion.EJ2.PdfViewer.PdfViewerToolbarSettings { ShowTooltip = true, ToolbarItem = \"OpenOption\" })">
</ejs-pdfviewer>
window.onload = function () {
var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0];
pdfViewer.toolbar.showToolbarItem(new Array("OpenOption"), false);
}
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewer-Hide-Open-Command-885188351
In the preceding sample, the Open icon will not be shown in the PDF Viewer toolbar.
Conclusion
I hope you enjoyed learning about how to hide the toolbar items from the PDF Viewer toolbar in .NET Core.
You can refer to the .NET Core PDF feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our ASP.NET Core PDF Viewer example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums or feedback portal. We are always happy to assist you!