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); }

In reply to PDF::Tk Background Image by qwertywolf

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.