Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Win32::IEAutomation - save pdf file (webpage format)

by prasadbabu (Prior)
on Dec 02, 2011 at 07:24 UTC ( #941252=perlquestion: print w/replies, xml ) Need Help??
prasadbabu has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I tried to open a web page and save a pdf file in the local folder. Below is the code. I could able to open the file successfully and pdf file is opening in the webpage format and I am not able to save the file (pdf). Please let me know where am i making mistake? or suggest me some solution to save the pdf file in the local system.
Note: I changed the name of the site and username/password for security reasons.

use Win32::IEAutomation; use Data::Dumper; use LWP::Simple; $\="\n"; $,=" "; $ie=Win32::IEAutomation->new(visible=>1, maximize=>1); $url=''; $ie->gotoURL($url); $ie->getTextBox('name:', 'loginName')->SetValue('test'); $ie->getTextBox('name:', 'password')->SetValue('test'); $ie->getButton('name:', 'loginBtn')->Click; $url1 = ''; $ie->gotoURL($url1); print "Logged in Successfully.....\n"; $ie->getSelectList('name:', 'field')->SelectItem("A Type"); $ie->getSelectList('name:', 'value')->SelectItem("A Notice"); $ie->getButton('name:', 'submitBtn')->Click; $url2 = ''; $ie->gotoURL($url2); print "Reading PDF files.....\n"; $url3 = ' +49.pdf'; $ie->gotoURL($url3); print "Selected PDF file Successfully.....\n"; my $file = get ("$url3") ; open( FILE, '>', "D:\\filename.pdf" ) or die $!; binmode FILE; print FILE $file; close( FILE ); print "Downloaded.....\n";

Thanks in advance


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://941252]
Approved by planetscape
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2017-09-20 06:39 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (233 votes). Check out past polls.