Hide Open file from toolbar

 PdfViewerControl

I need remove Open button. I don't allow user to access another file from this control

I see that is old request. I wonder why you not apply it. It's very needed. My user should be focus on my material not browsing the disk files.

So I try hide it by Reflection:


var
 toolbar =(ToolStrip)pdfV.Controls[0].Controls[0].Controls[0];
var itemsProperty = toolbar.GetType().GetProperty("Items",BindingFlags.NonPublic|BindingFlags.Instance);


But for some reasons the Items prop not accessible and return null.

Also your old Simple example code for custom ToolBarhttp://www.syncfusion.com/downloads/support/forum/121648/ze/CustomToolbar-879685658.zipNot work for me on Core.


3 Replies

YM Yathavakrishnan Mohan Syncfusion Team March 25, 2025 01:42 PM UTC

We will validate this behavior and provide further updates on March 26th, 2025.



MC Matanya Cohen March 25, 2025 06:46 PM UTC

Thanks.
Notice actually need way to prevent Open and/or Save. As explain both have lot reason to not include on custom application as we point above.

I very suggest to add it to Control prop:

bool OpenbuttonVisible 
bool SavebuttonVisible 



YM Yathavakrishnan Mohan Syncfusion Team March 26, 2025 06:14 AM UTC

We can meet your requirement to hide the open and save buttons on the toolbar by using the ToolbarSettings API. This API allows you to control the visibility of toolbar buttons. Please refer the below code snippet for your reference.
 //Load the document ot PDFViewer control
 pdfviewerControl.Load("../../../Data/Input.pdf");
 //Change the visibility of open and save button
 pdfviewerControl.ToolbarSettings.OpenButton.IsVisible = false;
 pdfviewerControl.ToolbarSettings.SaveButton.IsVisible = false;
Additionally We have created a sample for the same and attached below for your reference.

Attachment: Winforms_Sample_fd52b2a4.zip

Loader.
Up arrow icon