#!/usr/bin/perl -w BEGIN { unshift @INC, "lib", "../lib" } use strict; use PDF::Create; my $pdf = new PDF::Create('filename' => '/html/mypdf.pdf', 'Version' => 1.2, 'PageMode' => 'UseNone', 'Author' => 'Ovaltine', 'Title' => 'Anything', ); my $root = $pdf->new_page('MediaBox' => [ 0, 0, 612, 792 ]); # Add a page which inherits its attributes from $root my $page = $root->new_page; # Prepare 2 fonts my $f1 = $pdf->font('Subtype' => 'Type1', 'Encoding' => 'WinAnsiEncoding', 'BaseFont' => 'Helvetica'); my $f2 = $pdf->font('Subtype' => 'Type1', 'Encoding' => 'WinAnsiEncoding', 'BaseFont' => 'Helvetica-Bold'); # Prepare a Table of Content my $toc = $pdf->new_outline('Title' => 'Document', 'Destination' => $page); $page->stringc($f2, 40, 306, 626, "PDF::Create 2"); $page->stringc($f1, 20, 306, 596, "version $PDF::Create::VERSION"); # Add another page my $page2 = $root->new_page; $page2->stringc($f1, 20, 306, 400, 'Let us see what is on page 2.'); $page2->line(40, 40, 572, 40); $page2->line(40, 752, 572, 752); # Add something to the first page $page->stringc($f1, 20, 306, 400, 'by Ovaltine '); $page->stringc($f1, 15, 306, 350, 'More text for the reading.'); # Add the missing PDF objects and a the footer then close the file $pdf->close;