I am new to PERL and don't even know where to start. This code was written before me and they want me to use PDF::Tk now.
What it does is takes the HTML that is in the CGI, it puts those into lines, turns those lines into PS lines and then turns those PS lines into PDF lines and prints out the PDF.
So after the PDF lines are printed we need to stick an image behind all the lines of text. Can anyone help with that?
sub printFilePdf {
my $unique_id = shift;
my ($file) = "$OUTFILES/$unique_id.html";
open(my $htmlFH, '<', $file) or die "Can't open file $file $!\n";
my $processId = open2(\*POUT, \*PIN, qq(html2ps -U -f /home/apache
+/cgi-bin/test/html2psrc-tst));
my @lines = <$htmlFH>;
print PIN @lines;
close PIN;
my @psLines;
while (<POUT>)
{
chomp;
push(@psLines,$_);
}
waitpid $processId, 0;
$processId = open2(\*POUT, \*PIN, qq(ps2pdf -sPAPERSIZE=letter - -
+));
print PIN "$_\n" foreach(@psLines);
close PIN;
my @pdfLines;
while (<POUT>) {
chomp;
push(@pdfLines, $_);
}
waitpid $processId, 0;
#I am thinking right about here
print "Content-Type: application/pdf\n";
print "Content-Disposition: attachment; filename=record.pdf\n\n";
print "$_\n" foreach(@pdfLines);
}