PDF::API2::Simple 1.1.3u

PDF::API2::Simple is a simplistic wrapper for the excellent PDF::API2 modules.
PDF::API2::Simple is a simplistic wrapper for the excellent PDF::API2 modules.

SYNOPSIS

use PDF::API2::Simple;

my $pdf = PDF::API2::Simple->new(
file => 'output.pdf'
);

$pdf->add_font('VerdanaBold');
$pdf->add_font('Verdana');
$pdf->add_page();

$pdf->link( 'http://search.cpan.org', 'A Hyperlink',
x => 350,
y => $pdf->height - 150 );

for (my $i = 0; $i < 250; $i++) {
my $text = "$i - All work and no play makes Jack a dull boy";

$pdf->text($text, autoflow => 'on');
}

$pdf->save();

Take note that PDF coordinates are not quite what you're used to. The coordinate, (0, 0) for instance is at the lower-left hand corner. Thus, x still grows to the right, but y grows towards the top.

METHODS

new
PDF::API2::Simple->new(
'file' => 'output.txt',
'width' => 612,
'height' => 792,
'line_height' => 10,
'margin_left' => 20,
'margin_top' => 20,
'margin_right' => 20,
'margin_bottom' => 50,
'width_right' => 0,
'height_bottom' => 0,
'effective_width' => 0,
'effective_height' => 0,
'header' => undef,
'footer' => undef,
);

Creates a new PDF::API2::Simple instance. A good strategy is to create a new object for each pdf file you want to create. That is, of course, up to you.

file - The PDF file you want to write to. No default, parameter required

width - The width of the PDF file. Defaults to 612, the 8 1/2 x 11 US Letter width

height - The height of the PDF file. Defaults to 792, the 8 1/2 x 11 US Letter height

line_height - The standard height you want to define for lines. The default is 10

margin_left - The amount of margin space you want on the left side. Of course, you can specify whatever coordniates you want. Default is 20

margin_top - The amount of margin space you want on the top of each page. Default is 20

margin_right - The amount of margin space you want of the right side of each page. Default is 20

margin_bottom - The amount of margin space you want on the bottom of each page. Default is 50

width_right - A convenience property that contains the furthest x of the page, accounting for the margins specified

height_bottom - A convenience property that contains the largest y of the page, accounting for the bottom margin

effective_width - A convenience property that contains the width of the page, after the left and right margin have been accounted for

effective_height - A convenience property that contains the height of the page, after the top and bottom margin have been accounted for

header - This CODE reference will be called everytime a page is appended to the PDF, allowing you to specifiy a header for your pages

footer - This CODE reference will be called everytime a page is ended, allowing you to specifiy a footer for your pages

open
PDF::API2::Simple->open(
'open_file' => 'my_pdf.pdf',
'open_page' => 1, # Default is 1.
# Any other options to new.
);

This method opens an existing PDF for editing. You can include any other arguments that are valid for new and they will be set in the resulting object.

Requirements:

· Perl

last updated on:
December 11th, 2007, 22:58 GMT
price:
FREE!
developed by:
Red Tree Systems, LLC
homepage:
search.cpan.org
license type:
Public Domain 
category:
ROOT \ Multimedia \ Graphics

FREE!

In a hurry? Add it to your Download Basket!

user rating 13

2.4/5
 

0/5

Rate it!

Add your review!

SUBMIT