9 Replies - 2701 Views - Last Post: 15 February 2013 - 09:36 AM Rate Topic: -----

#1 Antu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 17-December 12

How to open a downloaded pdf file in vb.net

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  Icon User is offline

  • D.I.C Head

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

Re: How to open a downloaded pdf file in vb.net

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.
Was This Post Helpful? 0
  • +
  • -

#3 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

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

Re: How to open a downloaded pdf file in vb.net

Posted 13 February 2013 - 10:25 AM

View PostAntu, 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.
Was This Post Helpful? 0
  • +
  • -

#4 Antu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 17-December 12

Re: How to open a downloaded pdf file in vb.net

Posted 14 February 2013 - 05:41 AM

View PostTheKirk, 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.
Was This Post Helpful? 0
  • +
  • -

#5 TheKirk  Icon User is offline

  • D.I.C Head

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

Re: How to open a downloaded pdf file in vb.net

Posted 14 February 2013 - 09:08 AM

View PostAntu, 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";
WebBrowser.Navigate("http://docs.google.com/viewer?url=" + pdf_url);


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/

Was This Post Helpful? 0
  • +
  • -

#6 Antu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 17-December 12

Re: How to open a downloaded pdf file in vb.net

Posted 14 February 2013 - 09:31 AM

View PostTheKirk, on 14 February 2013 - 09:08 AM, said:

View PostAntu, 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";
WebBrowser.Navigate("http://docs.google.com/viewer?url=" + pdf_url);


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
Was This Post Helpful? 0
  • +
  • -

#7 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

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

Re: How to open a downloaded pdf file in vb.net

Posted 14 February 2013 - 05:05 PM

View PostAntu, 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.
  • Download it to disk
  • 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.)

Was This Post Helpful? 1
  • +
  • -

#8 Antu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 17-December 12

Re: How to open a downloaded pdf file in vb.net

Posted 15 February 2013 - 06:06 AM

View Postlar3ry, on 14 February 2013 - 05:05 PM, said:

View PostAntu, 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.
  • Download it to disk
  • 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.
Was This Post Helpful? 0
  • +
  • -

#9 TheKirk  Icon User is offline

  • D.I.C Head

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

Re: How to open a downloaded pdf file in vb.net

Posted 15 February 2013 - 07:14 AM

View PostAntu, on 15 February 2013 - 06:06 AM, said:

View Postlar3ry, on 14 February 2013 - 05:05 PM, said:

View PostAntu, 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.
  • Download it to disk
  • 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.
Was This Post Helpful? 0
  • +
  • -

#10 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

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

Re: How to open a downloaded pdf file in vb.net

Posted 15 February 2013 - 09:36 AM

View PostAntu, 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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1