Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello guys,

this is my first post so I wanted to say, what a great community.
I have a problem with a WebBrowserControl when opening a pdf with parameters.

I call it like this:
var url = new Uri("C:\\tmp\\MyPdf.pdf#navpanes=0&toolbar=0");
WebBrowserControl1.Navigate(url);


It is working, without any problems until I use the same command again.
The WebBrowserControl gets gray because of the adobe acrobat background.

I tried to reset the page with WebBrowserControl1.Navigate(about:blank) before reopening again, but this was also not working.

Greets
Max
Posted

1 solution

I have an solution.
try this.
First add an panel for imbeding the webbrowser it's in.
Then use this method for open the page
C#
void OpenWebPage(ref WebBrowser _webBrowser,string _link)
       {
           if (!_webBrowser.IsDisposed)
               _webBrowser.Dispose();

           _webBrowser = new WebBrowser();
           panel2.Controls.Add(_webBrowser);
           _webBrowser.Dock = DockStyle.Fill;
           _webBrowser.Show();
           _webBrowser.Navigate(_link);
       }


click like this.
C#
private void button1_Click(object sender, EventArgs e)
        {
            OpenWebPage(ref webBrwser, "C:\\tmp\\typescript.pdf#navpanes=0&toolbar=0");
        }        
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900