You can call outlines() from a PDF::API2 instance to get a PDF::API2::Outlines object. That's what the line in the PDF::API2::Outlines constructor section is telling you.
$otl = PDF::API2::Outline->new $api,$parent,$prev Returns a new outline object (called from $otls->outline).
I got the following to work. Started with an example (ex 12-5) I found in the O'Reilly book 'Perl Graphics Programming' by Shawn Wallace. But it's mostly from the documentation for PDF::API2.
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();
In reply to Re: PDF::API2::Outline functions
by Lotus1
in thread PDF::API2::Outline functions
by Copacetic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |