Re: Creating new pages automatically with PDF::API2
- From: Bill H <bill@xxxxxxxxx>
- Date: Sun, 11 May 2008 13:03:02 -0700 (PDT)
On May 11, 3:51 am, hotkitty <stpra...@xxxxxxxxx> wrote:
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;
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
.
- References:
- Creating new pages automatically with PDF::API2
- From: hotkitty
- Creating new pages automatically with PDF::API2
- Prev by Date: Re: DROP TABLE customers
- Next by Date: Re: Perl DBI Module: SQL query where there is space in field name
- Previous by thread: Creating new pages automatically with PDF::API2
- Next by thread: FAQ 4.24 How do I reverse a string?
- Index(es):
Relevant Pages
|
|