#!/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;