PdfViewer - Customize Menu items

Hi,

I would like to use your current version PDFVIEWER for WPF but I want to limit some areas like LOAD, Save and/or Print
Could I get a complete sample template So I can edit these areas?
Please also include the left side options also (thumbnails, bookmarks...etc) in the template

While working with copyrighted documents, the option to save or print could violate some rights.
I would need to turn on or off some options depending on individual document rights.

(work around could be set in  PDF file security options at creation)

Meanwhile I will try some suggestions on this thread
https://www.syncfusion.com/forums/107994/disabling-toolbar-buttons-in-pdfviewercontrol

I tried  PdfViewerControl1.ToolbarSettings.ShowFileTools = false;
while this works it eliminates all options Open/Save/Print at once instead of individualy

Thanks

Eric



7 Replies 1 reply marked as answer

US Uthandaraja Selva Sundara Kani Syncfusion Team June 22, 2020 09:14 AM UTC

Hi Eric, 
 
Thanks for contacting Syncfusion support. 
 
On further analysis, we can achieve the requirement of “Disable the PdfViewerControl toolbar and left pane elements individually” using the below code snippet, 
 
 
//Get the instance of the toolbar using its template name 
DocumentToolbar toolbar = pdfViewerControl.Template.FindName("PART_Toolbar", pdfViewerControl) as DocumentToolbar; 
 
//Get the instance of the open file button using its template name 
Button openButton = (Button)toolbar.Template.FindName("PART_ButtonOpen", toolbar); 
//Set false to disable the button.  
openButton.IsEnabled = false; 
 
//Get the instance of the left pane using its template name 
OutlinePane outlinePane = pdfViewerControl.Template.FindName("PART_OutlinePane", pdfViewerControl) as OutlinePane; 
 
//Get the instance of the thumbnail button using its template name 
ToggleButton thumbnailButton = (ToggleButton) outlinePane.Template.FindName("PART_ThumbnailButton", outlinePane); 
thumbnailButton.IsEnabled = false; 
 
 
We have created a sample for the same and it can be downloaded from below link, 
 
 
After ran the sample, please click the “Disable” button to disable the open, save, print, left pane elements. 
 
Please find the other toolbar button names from the below UG documentation, 
 
 
The left pane elements names are available in the above sample. 
 
Please let us know the provided solution meets your requirement. 
 
Regards, 
Uthandaraja S 


Marked as answer

EV Estelle Vega July 18, 2020 07:23 AM UTC

Ok, that is clear now. Thank you for your answer


US Uthandaraja Selva Sundara Kani Syncfusion Team July 20, 2020 10:23 AM UTC

Hi Estelle, 
 
You are welcome. Please let us know if you need any other assistance 
 
Regards, 
Uthandaraja S 



OS Ondrej Svoboda January 15, 2021 02:28 PM UTC

Hi,
seems that your example doesn't work anymore (in version 18.4.0.34), probably the template has been changed resulting in openButton being null and rest of the code is failing. And also provided help link has old info in there.
Can you please provide an updated example? What I need is to hide Open and Save (as) buttons and move print button to the main toolbar - I don't want to have it in popup.

Thank you!


DD Divya Dhayalan Syncfusion Team January 18, 2021 06:46 PM UTC

Hi Ondrej, 
 
Please find the details below, 
 
Query 
Details 
seems that your example doesn't work anymore (in version 18.4.0.34), probably the template has been changed resulting in openButton being null and rest of the code is failing. And also provided help link has old info in there. 
Sorry for the inconvenience caused, 
 
In our recent release 2020 Volume 4 release (18.4 version), we have added “Save As” support in our control. Based on user convenience, we have grouped the File Menu items (Open, Save, Save As and Print) into a Single Toggle Button. The Button controls Open, Save and Print are now changed to Menu item. We will update the UG contents with the above-mentioned information.  
 
Can you please provide an updated example? What I need is to hide Open and Save (as) buttons and move print button to the main toolbar - I don't want to have it in popup. 
Based on your requirement we have created a sample, in which we have removed the File menu items from the toolbar wrap panel and added a button for Print.  Sample can be downloaded from the below link, https://www.syncfusion.com/downloads/support/forum/155391/ze/PdfViewerWPF1294043857.  
 
Please let us know whether the provided sample is helpful to achieve your requirement or if you need any further assistance on this. 
 
  
Regards, 
Divya 



OS Ondrej Svoboda January 20, 2021 01:26 PM UTC

Works fine, thanks.


DD Divya Dhayalan Syncfusion Team January 21, 2021 06:38 AM UTC

Hi Ondrej, 
 
Most welcome, please let us know if you need any further assistance on this. 
 
Regards, 
Divya

Loader.
Up arrow icon