Creating new pages automatically with PDF::API2

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Since no one in the beginners group could answer this I thought I'd
ask it to this group. I am using PDF::API2 to create PDF files from a
bunch of separate text files I have. The issue I am having is that I
am only able to create the first page of each text file and I haven't
been able to figure out how to automatically generate additional pages
if the text document requires it. In the PDF::API2::Simple module,
there is "autoflow", which will generate the additional pages you need
and fill it with the appropriate text. I have the following code and
would appreciate if anyone could guide me to how I can generate multi-
page pdf's (I've omitted some of the code that isn't relevant to
creating the pdf files):


use warnings;

use LWP::Simple;
use HTML::TokeParser;
use PDF::API2;
use Text::Autoformat;
my $pdffile = '$file';
my $pdf = PDF::API2->new( -file => "$directoryname/$file.pdf");
my $page = $pdf->page;


 my $times = $pdf->corefont( 'Times', -encoding => 'latin1');

my $main_text = $page->text;
$main_text->font($times, 14);
$main_text->translate(15, 650);
$main_text->paragraph("@body\n", 575, 144, -align => "justify");


Re: Creating new pages automatically with PDF::API2

Quoted text here. Click to load it

I use PDF:API2 alot. It is easy to create a new page, when you are
done adding to the existing page you just do a new $page = $pdf->$page
and start writing to the second page.

Bill H

Site Timeline