Page 1 of 1

## 9 Replies - 5587 Views - Last Post: 15 February 2013 - 09:36 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=312113&amp;s=2a3982a19a00dfbbf9c2f7c15a30a50e&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 Antu

Reputation: 0
• Posts: 23
• Joined: 17-December 12

Posted 13 February 2013 - 05:01 AM

Hello All,
I am currently making a Web Browser. So here is the problem.
When we google some search results is a link to pdf files. When we download it saves the file on temporary folder and opens it with the default pdf reader.

How to open this pdf file in the web browser it self like in chrome and IE.
Please forgive me for any typos or grammar mistakes.
Is This A Good Question/Topic? 0

## Replies To: How to open a downloaded pdf file in vb.net

### #2 TheKirk

Reputation: 7
• Posts: 58
• Joined: 10-February 13

Posted 13 February 2013 - 06:51 AM

I assume you are creating a web browser using the WebBrowser control. The webbrowser control is basiclly Internet Explorer. If the PDF reader that is in installed does not have an Internet Explorer extensions installed, it can never be opened in the WebBrowser control.

Now you could try something like:

WebBrowser.Navigate("C:\path\to\saved\pdf\file.pdf");


If there's a PDF browser extension installed it will open de PDF file in the browser.

### #3 lar3ry

• Coding Geezer

Reputation: 310
• Posts: 1,290
• Joined: 12-September 12

Posted 13 February 2013 - 10:25 AM

Antu, on 13 February 2013 - 06:01 AM, said:

Hello All,
I am currently making a Web Browser. So here is the problem.
When we google some search results is a link to pdf files. When we download it saves the file on temporary folder and opens it with the default pdf reader.

How to open this pdf file in the web browser it self like in chrome and IE.

I don't know if it will open in the browser control, but you might want to take a look at the AxAcroPDF control (the Ax indicates that it is an Active-X control that is hosted by AxHost to allow it to be used in VB.Net).

You can get the control in Visual Studio by right-clicking on the control toolbox. Select Choose Item, then select the COM Components tab, the choose the Adobe PDF Reader. If it doesn't work within your WebBrowser control, you could open it in the control, separately.

### #4 Antu

Reputation: 0
• Posts: 23
• Joined: 17-December 12

Posted 14 February 2013 - 05:41 AM

TheKirk, on 13 February 2013 - 06:51 AM, said:

I assume you are creating a web browser using the WebBrowser control. The webbrowser control is basiclly Internet Explorer. If the PDF reader that is in installed does not have an Internet Explorer extensions installed, it can never be opened in the WebBrowser control.

Now you could try something like:

WebBrowser.Navigate("C:\path\to\saved\pdf\file.pdf");


If there's a PDF browser extension installed it will open de PDF file in the browser.

Thank you,
where can I get this PDF Extension.

### #5 TheKirk

Reputation: 7
• Posts: 58
• Joined: 10-February 13

Posted 14 February 2013 - 09:08 AM

Antu, on 14 February 2013 - 05:41 AM, said:

Thank you,
where can I get this PDF Extension.

That's something that needs to be handeld on the client side. The user of your software should have a PDF reader browser extension installed. However there's another way.
You could use Google Doc's to show the PDF to the user:

http://docs.google.com/viewer?url=PDF URL


So in code that would mean:

string pdf_url = "http://research.google.com/archive/bigtable-osdi06.pdf";


Note: Use the following website if you want to translate the code above from C# to VB.Net:

http://www.developerfusion.com/tools/convert/csharp-to-vb/


### #6 Antu

Reputation: 0
• Posts: 23
• Joined: 17-December 12

Posted 14 February 2013 - 09:31 AM

TheKirk, on 14 February 2013 - 09:08 AM, said:

Antu, on 14 February 2013 - 05:41 AM, said:

Thank you,
where can I get this PDF Extension.

That's something that needs to be handeld on the client side. The user of your software should have a PDF reader browser extension installed. However there's another way.
You could use Google Doc's to show the PDF to the user:

http://docs.google.com/viewer?url=PDF URL


So in code that would mean:

string pdf_url = "http://research.google.com/archive/bigtable-osdi06.pdf";


Note: Use the following website if you want to translate the code above from C# to VB.Net:

http://www.developerfusion.com/tools/convert/csharp-to-vb/


But when I try to open it just downloads it. How to get it to identify the pdf and its location (because in some websites they give the pdf files to download. while the others save it in the temporary folder.)
Any other ideas!
Antu

### #7 lar3ry

• Coding Geezer

Reputation: 310
• Posts: 1,290
• Joined: 12-September 12

Posted 14 February 2013 - 05:05 PM

Antu, on 14 February 2013 - 10:31 AM, said:

But when I try to open it just downloads it. How to get it to identify the pdf and its location (because in some websites they give the pdf files to download. while the others save it in the temporary folder.)

I don't know about Internet Explorer (because I don't use it), but all the browsers I use leave that choice up to the user. If I set the preferences to download PDF files, that's what they'll do. If I set it to show them in the browser, they'll show in the browser.

I still think that the Adobe PDF control is the way to go. I would handle showing it in the browser something like this...
• Detect that it's a PDF file.
• Enlarge the PDF control to fit the client area of the browser and position it so it completely covers the browser control
• Show the PDF in it, along with some controls for whatever you want to allow the user to do with it (save, search, etc.)

### #8 Antu

Reputation: 0
• Posts: 23
• Joined: 17-December 12

Posted 15 February 2013 - 06:06 AM

lar3ry, on 14 February 2013 - 05:05 PM, said:

Antu, on 14 February 2013 - 10:31 AM, said:

But when I try to open it just downloads it. How to get it to identify the pdf and its location (because in some websites they give the pdf files to download. while the others save it in the temporary folder.)

I don't know about Internet Explorer (because I don't use it), but all the browsers I use leave that choice up to the user. If I set the preferences to download PDF files, that's what they'll do. If I set it to show them in the browser, they'll show in the browser.

I still think that the Adobe PDF control is the way to go. I would handle showing it in the browser something like this...
• Detect that it's a PDF file.
• Enlarge the PDF control to fit the client area of the browser and position it so it completely covers the browser control
• Show the PDF in it, along with some controls for whatever you want to allow the user to do with it (save, search, etc.)

Sorry if it is a stupid question.
Does the user need to install Adobe PDF Reader for doing that function.

### #9 TheKirk

Reputation: 7
• Posts: 58
• Joined: 10-February 13

Posted 15 February 2013 - 07:14 AM

Antu, on 15 February 2013 - 06:06 AM, said:

lar3ry, on 14 February 2013 - 05:05 PM, said:

Antu, on 14 February 2013 - 10:31 AM, said:

But when I try to open it just downloads it. How to get it to identify the pdf and its location (because in some websites they give the pdf files to download. while the others save it in the temporary folder.)

I don't know about Internet Explorer (because I don't use it), but all the browsers I use leave that choice up to the user. If I set the preferences to download PDF files, that's what they'll do. If I set it to show them in the browser, they'll show in the browser.

I still think that the Adobe PDF control is the way to go. I would handle showing it in the browser something like this...
• Detect that it's a PDF file.
• Enlarge the PDF control to fit the client area of the browser and position it so it completely covers the browser control
• Show the PDF in it, along with some controls for whatever you want to allow the user to do with it (save, search, etc.)

Sorry if it is a stupid question.
Does the user need to install Adobe PDF Reader for doing that function.

As far as I am concerned, no.

### #10 lar3ry

• Coding Geezer

Reputation: 310
• Posts: 1,290
• Joined: 12-September 12

Posted 15 February 2013 - 09:36 AM

Antu, on 15 February 2013 - 07:06 AM, said:

Sorry if it is a stupid question.
Does the user need to install Adobe PDF Reader for doing that function.

Yes. As well, if you are compiling on a 64-bit machine, you must explicitly compile your program as a 32-bit application.