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" ; }
In reply to Perl script to download readable .pdf file. by rachard11
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |