Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hide the Adobe Reader toolbar when displaying a PDF in the .NET WebBrowser control?

Tags:

I am trying to load a PDF document inside a .NET web browser control. In versions of Adobe Reader prior to v10 (aka "X"), the PDF loaded without the toolbar displayed—you would just see the PDF document. In the newly-released Reader v10, there is a toolbar that I do not wish to see. I am wondering if anyone knows how to hide this toolbar.

I'm thinking that the answer may lie in the Registry, as there is no direct code that I am using to access Reader. Everything is handled by mime types through the WebBrowser control.

My code to load the PDF file is as follows:

string url = @"http://www.domain.com/file.pdf"; this._WebBrowser.Navigate(url); 

Adobe Reader toolbar that I wish to hide

like image 395
Grant Avatar asked Dec 23 '10 01:12

Grant


People also ask

How do I hide the PDF toolbar in my browser?

There is an option to hide the menu bar using the F9 key on the keyboard and Tools bar using the F8 key OR go to View>> Showhide>> Menu bar/Toolbar items. We can hide the menu bar for a specific document by going to the Document Properties>>Initial view>> choose the options that you want to hide.

How do I hide the toolbar in Adobe Reader?

To permanently hide the RHP in Acrobat Reader, do the following: Go to Edit > Preferences > Documents, and then select Remember current state of Tools pane. Open a PDF document in Reader, and then collapse the Tools pane. Click OK.

How do I get rid of the toolbar at the bottom of a PDF?

Right click on the toolbar and choose "hide toolbar". You can also use View->Show/Hide to choose what is hidden and what is visible.

How do I open a PDF without the toolbar?

Open the pdf file in acrobat pro, then go: File>properties, initial view tab, then under "interface options" check all three: hide menu bar, hide toolbars, hide window controls.


1 Answers

It appears the default setting for Adobe Reader X is for the toolbars not to be shown by default unless they are explicitly turned on by the user. And even when I turn them back on during a session, they don't show up automatically next time. As such, I suspect you have a preference set contrary to the default.

The state you desire, with the top and left toolbars not shown, is called "Read Mode". If you right-click on the document itself, and then click "Page Display Preferences" in the context menu that is shown, you'll be presented with the Adobe Reader Preferences dialog. (This is the same dialog you can access by opening the Adobe Reader application, and selecting "Preferences" from the "Edit" menu.) In the list shown in the left-hand column of the Preferences dialog, select "Internet". Finally, on the right, ensure that you have the "Display in Read Mode by default" box checked:

   Adobe Reader Preferences dialog

You can also turn off the toolbars temporarily by clicking the button at the right of the top toolbar that depicts arrows pointing to opposing corners:

   Adobe Reader Read Mode toolbar button

Finally, if you have "Display in Read Mode by default" turned off, but want to instruct the page you're loading not to display the toolbars (i.e., override the user's current preferences), you can append the following to the URL:

#toolbar=0&navpanes=0

So, for example, the following code will disable both the top toolbar (called "toolbar") and the left-hand toolbar (called "navpane"). However, if the user knows the keyboard combination (F8, and perhaps other methods as well), they will still be able to turn them back on.

string url = @"http://www.domain.com/file.pdf#toolbar=0&navpanes=0"; this._WebBrowser.Navigate(url); 

You can read more about the parameters that are available for customizing the way PDF files open here on Adobe's developer website.

like image 64
Cody Gray Avatar answered Nov 10 '22 00:11

Cody Gray