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='www.test.com/pp/login.asp'; $ie->gotoURL($url); $ie->getTextBox('name:', 'loginName')->SetValue('test'); $ie->getTextBox('name:', 'password')->SetValue('test'); $ie->getButton('name:', 'loginBtn')->Click; $url1 = 'http://www.test.com/pp/lookup.asp'; $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 = 'http://www.test.com/pp/lookup.asp?pid=50643'; $ie->gotoURL($url2); print "Reading PDF files.....\n"; $url3 = 'http://test.test.net/files/b6533c01-9ddc-4865-8381-e774804b8a +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

Prasad


In reply to Win32::IEAutomation - save pdf file (webpage format) by prasadbabu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.