H
hotkitty
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):
#!/usr/bin/perl
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;
$page->mediabox('A4');
my $times = $pdf->corefont( 'Times', -encoding => 'latin1');
my $main_text = $page->text;
$main_text->font($times, 14);
$main_text->fillcolor('pearl');
$main_text->lead(16);
$main_text->translate(15, 650);
$main_text->paragraph("@body\n", 575, 144, -align => "justify");
$pdf->save;
$pdf->end;
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):
#!/usr/bin/perl
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;
$page->mediabox('A4');
my $times = $pdf->corefont( 'Times', -encoding => 'latin1');
my $main_text = $page->text;
$main_text->font($times, 14);
$main_text->fillcolor('pearl');
$main_text->lead(16);
$main_text->translate(15, 650);
$main_text->paragraph("@body\n", 575, 144, -align => "justify");
$pdf->save;
$pdf->end;