Okay, I've actually USED PDF::Create that others are suggesting and it's okay. In fact, this short program took some existing text and overlaid a grid on top of it to make nice column rules that the data lacked.
#!/usr/bin/perl -w use strict; use PDF::Create; my $font; my $height=792; my $width=612; my $left=20; my $topmargin=20; my $pointsize=8; my $spacing=$pointsize+3; sub addtext { my($page, $fh)=@_; my $l=0; my $hpos=$height-$topmargin; while(<$fh>) { $page->stringl($font, $pointsize, $left, $hpos-=$spacing, $_); last if ++$l > 66; } } sub boxpage { my($page)=@_; $page->line($left, $topmargin, $left, $height-$topmargin, ); $page->line( $left, $height-$topmargin, $width-$left, $height-$topmargin); $page->line( $width-$left, $height-$topmargin, $width-$left, $topmargin); $page->line( $width-$left, $topmargin, $left, $topmargin); $page->line($left+42, $topmargin, $left+42, $height-$topmargin); $page->line($left+81, $topmargin, $left+81, $height-$topmargin); $page->line($left+145, $topmargin, $left+145, $height-$topmargin); $page->line($left+183, $topmargin, $left+183, $height-$topmargin); } my $pdf=new PDF::Create('filename' => 'outfile.pdf', 'Version' => '1.2', 'Author' => 'Clinton Pierce', 'Title' => 'Test Report',); my $root=$pdf->new_page('MediaBox' => [ 0, 0, 612, 792 ]); $font=$pdf->font('Subtype' => 'Type1', 'Encoding' => 'WinAnsiEncoding', 'BaseFont' => 'Courier'); open(FH, $0) || die; while(not eof(FH)) { my $page=$root->new_page(); boxpage($page); addtext($page, \*FH); } $pdf->close;
Now the caveat is, there's not a whole lot PDF::Create can do. No colors. No bitmaps. Not much more than lines, circles and other polygons. No width control on the lines either.

And PDF::Create hasn't been updated in a long, long time and I got a bounce from the e-mail address of the maintainer. But I got enough out of it for my needs...


In reply to Re: Generating PDF by clintp
in thread Generating PDF by Anonymous Monk

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.