Bentov has asked for the wisdom of the Perl Monks concerning the following question:
My problem is this(as far as I know the only one I have so far) after I have created a new page, the text just continues to be written on the first page. What am I missing? I have looked at multiple tutorials and have tried to understand the documentation, but I'm still not understanding how to switch to the next page to begin writing to it... Thanks in advance for you assistance. Bentov#!/usr/bin/perl -w use strict; use PDF::API2; my $counter=0; my @line; my $line; my @files; my $files; my $xc=10; my $yc=780; my $pdf = PDF::API2->new(-file => "test.pdf"); my $page = $pdf->page; my $fnt = $pdf->corefont('Arial',-encode => 'latin1'); my $txt = $page->hybrid; $page->mediabox('LETTER'); $txt->textstart; $txt->font($fnt, 10); my $startdir="x:\\omni\\omni\\surgpref\\"; chdir($startdir); @files = <*.eal>; #.eal are just .txt files, I actually many differen +t extensions, that just designate different people. while ($files[$counter] ne "") { print("Encoding $files[$counter] to PDF format\n"); open(INFILE, "$startdir/$files[$counter]"); $line=<INFILE>; while($line ne "") { $txt->translate($xc,$yc); $yc-=10; if($yc==0){ $pdf->page(); $yc=780; } $txt->text($line); $counter++; $line=<INFILE>; } } $txt->textend; $pdf->save; $pdf->end( );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: PDF::API2 is confusing me to death..
by mpeters (Chaplain) on Sep 02, 2005 at 17:24 UTC | |
by Bentov (Novice) on Sep 06, 2005 at 18:26 UTC | |
by mpeters (Chaplain) on Sep 06, 2005 at 20:50 UTC |