Unfortunately, I don't really have the time to do a good job of learning Perl at this moment. I have hobbled together a script with DBI:
Code:
#!/usr/bin/perl -wT
use DBI;
use PDF::Create;
use CGI::Carp qw( fatalsToBrowser );
use CGI qw( :standard );
my $db = 'test';
my $host = 'test-mysql';
my $db_user = '';
my $db_password = '';
my $cid = 1;
$dbh = DBI -> connect ( "dbi:mysql:$db:$host", "$db_user", "$db_password",
{ RaiseError => 1, AutoCommit => 0});
$sth = $dbh->prepare("SELECT id FROM don_eoy");
$sth->execute( );
while ( @row = $sth->fetchrow_array() ) {
&do_pdf( $row[0] );
print( $row[0] );
}
sub do_pdf
The sub do_pdf routine is too long to post. It seems to work but it's streaming and not creating the individual pdfs. I can redirect the output to a file which contains all the various pdfs in one file (which is problematic).
The code should produce output files. As it was (a response to a click on a webpage) it produced the individual files, but now in my attempt to create a script which bulk creates pdfs it does not.
pertinent snippet:
Code:
use PDF::Create;
my $file_name = qq{$student_last_name\_$student_first_name.pdf};
print header( -type => 'application/x-pdf',
-attachment => $file_name );
my $pdf = new PDF::Create( 'filename' => '-', # Stdout
'Version' => 1.2,
'PageMode' => 'UseOutlines',
'Author' => 'Don ',
'Title' => 'Some Title',