rachard11 has asked for the wisdom of the Perl Monks concerning the following question:
The Perl code I am using (below) downloads a pdf file that I cannot read in Adobe Acrobat (Adobe message: "There was an error opening this document. The file is damaged and could not be repaired." Is there an alternative Perl module or method that will retain the file's readability? The file opens fine if I just navigate to the site in Chrome, download the file manually, and open in Acrobat.
#!/usr/bin/perl use strict; use warnings; use LWP; my $ua = LWP::UserAgent->new; my $output_file = "F:/SCAC Complaints/file_output.pdf" ; my $get_file = "http://securities.stanford.edu/filings-documents/1061/ +DI00_04/201753_f01c_17CV01097.pdf" ; open (my $fh1, '>', $output_file ) ; my $response =$ua->get($get_file); if ($response->is_success) { print $fh1 $response->content; close $fh1 ; } else { print "Error in $get_file \n" ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl script to download readable .pdf file.
by choroba (Cardinal) on May 05, 2017 at 15:37 UTC | |
by rachard11 (Acolyte) on May 05, 2017 at 15:44 UTC | |
|
Re: Perl script to download readable .pdf file.
by Anonymous Monk on May 05, 2017 at 15:41 UTC | |
|
Re: Perl script to download readable .pdf file.
by BillKSmith (Monsignor) on May 06, 2017 at 11:17 UTC | |
by Anonymous Monk on May 06, 2017 at 12:41 UTC | |
by BillKSmith (Monsignor) on May 06, 2017 at 18:38 UTC |