473,729 Members | 2,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Interne tExplorer = New SHDocVw.Interne tExplorer
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 21236
"MJ" <no**@nomail.co m> schrieb:
Automatically download and save pdf files from a website.

'WebClient.Down loadFile'.

--
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.Crede ntials = CredentialCache .DefaultCredent ials;
webClient.Downl oadFile(url, fileName);
}
catch (System.Excepti on e)
{
// Do something with exception
}
finally
{
webClient.Dispo se();
}
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.Interne tExplorer = New SHDocVw.Interne tExplorer
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******** *******@TK2MSFT NGP14.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.Crede ntials = CredentialCache .DefaultCredent ials;
webClient.Downl oadFile(url, fileName);
}
catch (System.Excepti on e)
{
// Do something with exception
}
finally
{
webClient.Dispo se();
}
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.Interne tExplorer = New SHDocVw.Interne tExplorer
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
4479
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 header information to the user and inquires if that user wishes to download the file. A sample of that code is below: header('Content-Type: application/save'); header('Content-Disposition:attachment; filename="'.$file_path .'"');
1
2011
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 cookie I can keep track of when the user last synced and build a file list in my asp.net code that displays which files need downloading. Next I want to put a button on the page that will download all of the files
3
2722
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 file on the server and automatically have it save in a user's specified folder. -Jay (patel at cs dot utk dot edu)
4
3617
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
3675
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 directions/sample code or anything. On my web application, I have a CheckBoxList that shows all the files. The user will check (select) the files to download, then click on the "Download" button. A SaveAs dialog pops up to allow the user to...
4
1474
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 important is secure, fast, and fault tolerant. We already have a secure website between sites so one of the ideas was to use a control to upload and download through there. For example, when downloading from MSDN they have a nice download utility that...
0
1571
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 standalone app (separate downloads, you don't need both). This is my second developer utility this year - my first being the Lorem Ipsum generator from a few weeks back. Download and get more info on WebPrecompiler at...
2
1686
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 or her own files in the website that will save the data immediatlly into database. and when the user sign in into his or her account he can download his own files.
1
47471
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 on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.