473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Automatically download and save pdf files from a website.

MJ
Automatically download and save pdf files from a website.

Is there a way to do this?

I would like to automate a daily procedure for downloading and saving a
couple of dozen pdf from several websites. Currently I have saved bookmarks
in a browser and manually open and save each one.

Some of the files have direct addresses, for example:
https://www.somewebsite.com/resource...rice_sheet.pdf

Some are dynamically generated, for example:
https://www.somewebsite.com/resource...te=MA&type=wsl
(this returns a pdf file to the browser)
I can get the directly addressed documents with some simple scripting of an
FTP client. It's the dynamically generated files that I'm having a hard time
figuring out. The only way I've been able to get the dymamically generated
files seems to be to request the url through a browser.
(Windows XP pro, ie 6.0, Acrobat Reader 7.0.0, VB.NET 2003)
Dim ieApp As SHDocVw.InternetExplorer = New SHDocVw.InternetExplorer
Dim sURL as String = "URL of file I want"
ieApp.Navigate(sURL)

This seems to work fine. Launches a browser, navigates to the URL, browser
invokes Acrobat, pdf document is displayed.

The two problems I don't know how to solve are:

1) Determining when the pdf document has finished downloading.
2) Saving it.
Thanks.

Mike


Nov 21 '05 #1
3 21155
"MJ" <no**@nomail.com> schrieb:
Automatically download and save pdf files from a website.

'WebClient.DownloadFile'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
Mike,

Here is some of my C# code that I use. Should be very easy to translate
into VB.NET. Give it a try and let me know how it goes.

WebClient webClient = new WebClient();
try
{
webClient.Credentials = CredentialCache.DefaultCredentials;
webClient.DownloadFile(url, fileName);
}
catch (System.Exception e)
{
// Do something with exception
}
finally
{
webClient.Dispose();
}
Jason Newell
MJ wrote:
Automatically download and save pdf files from a website.

Is there a way to do this?

I would like to automate a daily procedure for downloading and saving a
couple of dozen pdf from several websites. Currently I have saved bookmarks
in a browser and manually open and save each one.

Some of the files have direct addresses, for example:
https://www.somewebsite.com/resource...rice_sheet.pdf

Some are dynamically generated, for example:
https://www.somewebsite.com/resource...te=MA&type=wsl
(this returns a pdf file to the browser)
I can get the directly addressed documents with some simple scripting of an
FTP client. It's the dynamically generated files that I'm having a hard time
figuring out. The only way I've been able to get the dymamically generated
files seems to be to request the url through a browser.
(Windows XP pro, ie 6.0, Acrobat Reader 7.0.0, VB.NET 2003)
Dim ieApp As SHDocVw.InternetExplorer = New SHDocVw.InternetExplorer
Dim sURL as String = "URL of file I want"
ieApp.Navigate(sURL)

This seems to work fine. Launches a browser, navigates to the URL, browser
invokes Acrobat, pdf document is displayed.

The two problems I don't know how to solve are:

1) Determining when the pdf document has finished downloading.
2) Saving it.
Thanks.

Mike


Nov 21 '05 #3
MJ
Thanks a million Jason & Herfried. That's exactly what I was looking for. I
had no idea it was there (is my newbieness showing?).

Thanks again,
Mike


"Jason Newell" <no****@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
Mike,

Here is some of my C# code that I use. Should be very easy to translate
into VB.NET. Give it a try and let me know how it goes.

WebClient webClient = new WebClient();
try
{
webClient.Credentials = CredentialCache.DefaultCredentials;
webClient.DownloadFile(url, fileName);
}
catch (System.Exception e)
{
// Do something with exception
}
finally
{
webClient.Dispose();
}
Jason Newell
MJ wrote:
Automatically download and save pdf files from a website.

Is there a way to do this?

I would like to automate a daily procedure for downloading and saving a
couple of dozen pdf from several websites. Currently I have saved
bookmarks
in a browser and manually open and save each one.

Some of the files have direct addresses, for example:
https://www.somewebsite.com/resource...rice_sheet.pdf

Some are dynamically generated, for example:
https://www.somewebsite.com/resource...te=MA&type=wsl
(this returns a pdf file to the browser)
I can get the directly addressed documents with some simple scripting of
an FTP client. It's the dynamically generated files that I'm having a
hard time figuring out. The only way I've been able to get the
dymamically generated files seems to be to request the url through a
browser.
(Windows XP pro, ie 6.0, Acrobat Reader 7.0.0, VB.NET 2003)
Dim ieApp As SHDocVw.InternetExplorer = New SHDocVw.InternetExplorer
Dim sURL as String = "URL of file I want"
ieApp.Navigate(sURL)

This seems to work fine. Launches a browser, navigates to the URL,
browser invokes Acrobat, pdf document is displayed.

The two problems I don't know how to solve are:

1) Determining when the pdf document has finished downloading.
2) Saving it.
Thanks.

Mike



Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris Lobdell | last post by:
Hey, everyone. For the past two years, we have offered files for download through a secure website. Users, after clicking on a link, are redirected to a PHP page that passes the appropriate...
1
by: Marc Pelletier | last post by:
Hello all, I am a desktop programmer getting my feet wet on the web. I am trying to build a .net website that will keep a set of local files synchronized with a master set on the web. Using a...
3
by: Jay | last post by:
Hey there, Is there a way to have php automatically save a file that is being downloaded without having the annoying "Save As.." dialog box that appears? I would like to be able to create a txt...
4
by: C16 | last post by:
Hi All I have a simple download script for files on my website and I use the code below to download the files: $fp = fopen($filename, "rb"); if ( $fp ) { $filesize = $file;
5
by: Stanav | last post by:
Hello all, Thanks in advance for any replies... Now, my question is: Is it possible to do a multiple files download for a single response event on an aspx page? If there is, please give me some...
4
by: Jeff | last post by:
Our company has to find a way to transfer huge files, target is maximum of 6GB, between sites so we are looking to find the best way to do it. There are lots of criteria we need but the most...
0
by: HackingPSP | last post by:
I saw a lot of requests for a program like this, so I wrote it. Yeah, my site has "PSP software by Auri" but in this case it means "Pretty Sweet Programming" :) There's both a VS2005 add-in and a...
2
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: I'm working with project in my company by using ASP.Net 2.0 that allow the users to upload and download files to web site in the internet as backup. The user will first upload his...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.