I you want to add a new page, you are correct in using the $pdf->page() method, but you need to tell it what page to create. By default it will just give you the first page (and create it if it doesn't exist). So doing something like this (untested):
$page_num = 1;
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($page_count);
$txt = $page->hybrid;
$txt->textstart;
$txt->font($fnt, 10);
$page->mediabox('LETTER');
$yc=780;
}
$txt->text($line);
$counter++;
$line=<INFILE>;
}
}
Is probably more like what you want.
-- More people are killed every year by pigs than by sharks, which shows you how good we are at evaluating risk. -- Bruce Schneier
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|