PDF::API2 TUTORIAL and HOWTO

Document

Fonts and Text

Core Fonts

Q: How to use text with a 'corefont' ?

Answer: Noting's simpler than this if you know which fonts are defined:

Courier Courier-Bold Courier-BoldOblique Courier-Oblique
Helvetica Helvetica-Bold Helvetica-BoldOblique Helvetica-Oblique
Times-Roman Times-Bold Times-BoldItalic Times-Italic
Symbol ZapfDingbats

Example:

$pdf=PDF::API2->new;
$helv = $pdf->corefont('Helvetica');
$timb = $pdf->corefont('Times-Bold');
$zapf = $pdf->corefont('ZapfDingbats');
$page = $pdf->page;
$txt = $page->text;
$txt->font($helv,20);
$txt->text('Hello Helvetica !');
$txt->cr;
$txt->font($timb,20);
$txt->text('Hello Times-Bold !');
$txt->cr;
$txt->font($zapf,20);
$txt->text('Hello ZapfDingbats !');

Result:

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 9:

'=item' outside of any '=over'

=over without closing =back

Around line 52:

=end pod3pdf doesn't match =begin pod3pdf(400,70). (Stack: =over; =begin pod3pdf(400,70))

Around line 64:

=end pod3pdf doesn't match =begin pod3pdf(400,200). (Stack: =over; =begin pod3pdf(400,70); =begin pod3pdf(400,200))