PDF::API2::Outline(3p)

NAME
PDF::API2::Outline - Manage PDF outlines (a.k.a. bookmarks)

SYNOPSIS
    # 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));

METHODS

  Examine the Outline Tree
has_children

    my $boolean = $outline->has_children();

Return true if the current outline item has child items.

count

    my $integer = $outline->count();

Return the number of descendants that are visible when the current outline item is open (expanded).

first

    my $child = $outline->first();

Return the first child of the current outline level, if one exists.

last

    my $child = $outline->last();

Return the last child of the current outline level, if one exists.

parent

    my $parent = $outline->parent();

Return the parent of the current item, if not at the top level of the outline tree.

prev

    my $sibling = $outline->prev();

Return the previous item of the current level of the outline tree.

next

    my $sibling = $outline->next();

Return the next item of the current level of the outline tree.

  Modify the Outline Tree
outline

    my $child = $outline->outline();

Add an outline item at the end of the current outline's list of children.

insert_after

    my $sibling = $outline->insert_after();

Add an outline item immediately following the current item.

insert_before

    $sibling = $outline->insert_before();

Add an outline item immediately preceding the current item.

delete

    $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.

is_open

    # Get
    my $boolean = $outline->is_open();

    # Set
    my $outline = $outline->is_open($boolean);

Get/set whether the outline is expanded or collapsed.

  Set Outline Attributes
title

    # Get
    my $title = $outline->title();

    # Set
    $outline = $outline->title($text);

Get/set the title of the outline item.

destination

    $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.

$destination can optionally be the name of a named destination defined elsewhere.

uri

    $outline = $outline->uri($uri);

Launch a URI -- typically a web page -- when the outline item is activated.

launch

    $outline->launch($file);

Launch an application or file when the outline item is activated.

pdf

    $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.