Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, June 16, 2011 9:20 PM
Hi,
I am trying to open a local pdf file in a webbrowse control, but it opens a pdf reader instead of displaying in the webbrowser control when I call below code.
string file = @"C:\tem\abc.pdf";
this.webBrowser1.Navigate(file);
What do I miss?
TIA
Hwasoo Lee
All replies (7)
Saturday, June 18, 2011 6:35 AM âś…Answered
That is because the PDF reader has a configuration about displaying PDF in the web browsers, you need to configure it first. I don't know what PDF reader you are using, while the configuration is similar.
So take my PDF reader for example, by default, the PDF files are allowed to be open in the web browsers. After I unchecked the item "Display PDF in browser" as shown in the following image, the PDF files will be forced to be opened in the PDF reader but not in the WebBrowser control in my test project. That is it!
If you are using Adobe Reader 9 or 10 and this configuration does not take effect, you should follow the actions below:
1> You should make this configuration after opening the master program, not after opening the program by double click one PDF file.
2> Make sure you only have one version of Adobe Reader installed in your PC.
Leo Liu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Thursday, June 16, 2011 9:27 PM
Hi,
I am trying to open a local pdf file in a webbrowse control, but it opens a pdf reader instead of displaying in the webbrowser control when I call below code.
string file = @"C:\tem\abc.pdf";
this.webBrowser1.Navigate(file);What do I miss?
TIA
Hwasoo Lee
Hello Back9,
try this code:
private void button1_Click(object sender, EventArgs e)
{
string file = @"C:\tem\abc.pdf";
if (this.webBrowser1 != null)
{
this.webBrowser1.Navigate(file);
}
}
Hello
Carmelo La Monica http://community.visual-basic.it/carmelolamonica/
Thursday, June 16, 2011 9:32 PM
I know what you are trying to check out but the webBrowse1 is instantiated before used.
Thanks,
Hwasoo
Hwasoo Lee
Thursday, June 16, 2011 9:44 PM
I know what you are trying to check out but the webBrowse1 is instantiated before used.
Thanks,
Hwasoo
Hwasoo Lee
Hello Back9
forgive me but I have difficulty with English, I just realized that you probably have created an instance of a web browser, I understand you correctly?
Hello Carmelo La Monica http://community.visual-basic.it/carmelolamonica/
Thursday, June 16, 2011 9:51 PM
Yes, the problem is that the pdf file is opened in a adobe reader not in a web browser control as supposed.
Hwasoo Lee
Thursday, June 16, 2011 10:03 PM
Yes, the problem is that the pdf file is opened in a adobe reader not in a web browser control as supposed.
Hwasoo Lee
Hello Back9,
you can use this be used only for viewing pdf http://eclipsed4utoo.com/blog/view-pdf-windows-form/
Hello
Carmelo La Monica http://community.visual-basic.it/carmelolamonica/
Tuesday, June 21, 2011 9:41 AM
Hi,
Is any progress made with our friends' suggestions?
I am looking forward to hearing from you. Thanks.Leo Liu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.