Re: Automatically download and save pdf files from a website.
- From: "MJ" <none@xxxxxxxxxx>
- Date: Thu, 22 Sep 2005 16:29:38 -0400
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" <nospam@xxxxxxxxxx> wrote in message
news:%23zqoXC7vFHA.724@xxxxxxxxxxxxxxxxxxxxxxx
> 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/resources/documents/daily_price_***.pdf
>>
>> Some are dynamically generated, for example:
>> https://www.somewebsite.com/resources/documents/daily_price_sheets.jsp&account=012345&state=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
>>
>>
>>
>>
>>
.
- References:
- Prev by Date: Automatically download and save pdf files from a website.
- Next by Date: Custom control with panel...
- Previous by thread: Automatically download and save pdf files from a website.
- Next by thread: Custom control with panel...
- Index(es):