I am using the System.Windows.Controls.WebBrowser
web browser to enable users to view PDF files from within my WPF application.
I now want to prevent the user from having any options for interaction with the content displayed in the browser (i.e. they should not be able to print/ save/ highlight text/ copy any of the content displayed in the browser).
How would I do this?
I have added the WebBrowser
to the application with the line:
System.Windows.Controls.WebBrowser browser = new System.Windows.Controls.WebBrowser();
and am specifying the path of the file that they are viewing from within the code, but also giving them the options to select other files to view by using File -> Open and browsing to the location of the file that they want to open.
I couldn't find anything in the MSDN WebBrowser docs that indicated how I could disable the Save or Print buttons, 'right-click' functionality, or text highlighting... does anyone have any suggestions?
The problem is not the WebBrowser
. You are opening a PDF file within it, so it's either a plugin or built-in viewer. Controlling that is outside of the WebBrowser
properties and events.
You should consider using an actual PDF viewer control, such as ones suggested in this topic.