use strict; use warnings; use PDF::API2; # Create a pdf object. my $pdf = PDF::API2->new(-file => "test.pdf"); # Create a media box in pdf object. $pdf->mediabox(595,842); # Create font objects. my $fnt = $pdf->corefont('Verdana',-encode => 'latin1'); my $boldfont=$pdf->corefont('Verdana-Bold',-encode => 'latin1'); # Set the font size. my $font_size=8; # Create a page object. my $page = $pdf->page(0); # Create a text object on the page. my $txt = $page->text; $txt->font($boldfont,$font_size); $txt->translate(20,800); $txt->text("A Heading here."); $txt->font($fnt, $font_size); $txt->translate(100,750); $txt->font($fnt, $font_size); $txt->text("A small piece of text here."); # Read a large piece of text from a file and put it in a paragraph on the PDF document. open(FH, "; close FH; $txt->paragraph(join("\n", @fred), -x=>30, -y=>720, -w=>500, -h=>800); # Save the PDF and destroy the object. $pdf->save; $pdf->end( );