Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New Page with pdf::api2

Status
Not open for further replies.

mikri

Technical User
Dec 16, 2003
39
0
0
DE
Hi,

i want to create PDF Files from my UNIX text Files (the file ist mutch longer then one Page).
How can i create a new Page in the PDF Document with pdf::api2

Code:
#!/usr/bin/perl

use PDF::API2;

my $pdf = PDF::API2->new();
my $fnt = $pdf->corefont('Helvetica');
my $page = $pdf->page;

$page->mediabox('A4');
my $gfx = $page->gfx;


open (IN, "$ARGV[0]");
my $line = 810;
while (<IN>) {
        $gfx->textlabel(20,$line,$fnt,12,$_);
        $line = $line - 15;
}

$pdf->saveas('document.pdf');
$pdf->end;

The script will start with "pdf.pl textfile.txt"

Thx
mikri
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top