PDF::API2::Outline - Manage PDF outlines (a.k.a. bookmarks)
# Get/create the top-level outline tree my $outline = $pdf->outline(); # Add an entry my $item = $outline->outline(); $item->title('First Page'); $item->destination($pdf->open_page(1));
my $boolean = $outline->has_children();
Return true if the current outline item has child items.
my $integer = $outline->count();
Return the number of descendants that are visible when the current outline item is open (expanded).
my $child = $outline->first();
Return the first child of the current outline level, if one exists.
my $child = $outline->last();
Return the last child of the current outline level, if one exists.
my $parent = $outline->parent();
Return the parent of the current item, if not at the top level of the outline tree.
my $sibling = $outline->prev();
Return the previous item of the current level of the outline tree.
my $sibling = $outline->next();
Return the next item of the current level of the outline tree.
my $child = $outline->outline();
Add an outline item at the end of the current outline's list of children.
my $sibling = $outline->insert_after();
Add an outline item immediately following the current item.
$sibling = $outline->insert_before();
Add an outline item immediately preceding the current item.
$outline->delete();
Remove the current outline item from the outline tree. If the item has any children, they will effectively be deleted as well since they will no longer be linked.
# Get my $boolean = $outline->is_open(); # Set my $outline = $outline->is_open($boolean);
Get/set whether the outline is expanded or collapsed.
# Get my $title = $outline->title(); # Set $outline = $outline->title($text);
Get/set the title of the outline item.
$outline = $outline->destination($destination, $location, @args);
Set the destination page and optional position of the outline. $location and @args are as defined in "destination" in PDF::API2::NamedDestination.
$location
@args
$destination can optionally be the name of a named destination defined elsewhere.
$destination
$outline = $outline->uri($uri);
Launch a URI -- typically a web page -- when the outline item is activated.
$outline->launch($file);
Launch an application or file when the outline item is activated.
$outline = $outline->pdf($filename, $page_number, $location, @args);
Open another PDF file to a particular page number (first page is zero, which is also the default). The page can optionally be positioned at a particular location if $location and @args are set -- see "destination" in PDF::API2::NamedDestination for possible settings.
To install PDF::API2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PDF::API2
CPAN shell
perl -MCPAN -e shell install PDF::API2
For more information on module installation, please visit the detailed CPAN module installation guide.