$otl = PDF::API2::Outline->new $api,$parent,$prev Returns a new outline object (called from $otls->outline). #### use warnings; use strict; use PDF::API2; # Create a blank PLF file my $pdf = PDF::API2->new(-file => 'test7.pdf'); #------- Don't call new from PDF::API2::Outline directly... my $otls = $pdf->outlines(); # Add a built-in font to the PDF my $font = $pdf->corefont('Helvetica-Bold'); foreach my $section ( 1..3 ){ my $otl = $otls->outline; $otl->title("Section $section"); foreach my $pagenumber (1..4) { #add blank page... my $page = $pdf->page(); # Set the page size $page->mediabox('Letter'); my $text = $page->text(); $text->translate(225,600); $text->font($font, 20); $text->text("Hello world, s$section, p$pagenumber"); # add suboutline. my $sotl = $otl->outline(); $sotl->title("Page $pagenumber"); $sotl->dest($page); } } $pdf->save();