PDF::API2::NamedDestination(3)

NAME
PDF::API2::NamedDestination - Add named destinations (views) to a PDF

METHODS

  new
    $destination = PDF::API2::NamedDestination->new($pdf, ...);

Creates a new named destination object. If any additional arguments are present, they will be passed to destination().

  destination
    $destination = $destination->destination($page, $location, @args);

A destination is a particular view of a PDF, consisting of a page object, the location of the window on that page, and possible coordinate and zoom arguments.

    # The XYZ location takes three arguments
    my $dest1 = PDF::API2::NamedDestination->new($pdf);
    $dest->destination($pdf->open_page(1), 'xyz' => ($x, $y, $zoom));

    # The Fit location doesn't require any arguments
    my $dest2 = PDF::API2::NamedDestination->new($pdf);
    $dest->destination($pdf->open_page(2), 'fit');

The following locations are available:

•   xyz ($left, $top, $zoom)

    Display the page with the coordinates ($left, $top) positioned at the upper-left corner of the window and the contents of the page magnified by the factor $zoom. An "undef" value for any of the arguments specifies that the current value of that argument shall be retained unchanged. A zoom factor of 0 has the same meaning as "undef".

•   fit

    Display the page with its contents magnified just enough to fit the entire page within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the page within the window in the other dimension.

•   fith ($top)

    Display the page with the vertical coordinate $top positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of the page within the window. An "undef" value for $top specifies that the current value of that argument shall be retained unchanged.

•   fitv ($left)

    Display the page with the horizontal coordinate $left positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of the page within the window. An "undef" value for $left specifies that the current value of that argument shall be retained unchanged.

•   fitr ($left, $bottom, $right, $top)

    Display the page with its contents magnified just enough to fit the rectangle specified by the coordinates $left, $bottom, $right, and $top entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the rectangle within the window in the other dimension.

•   fitb

    Display the page with its contents magnified just enough to fit its bounding box entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the bounding box within the window in the other dimension.

•   fitbh ($top)

    Display the page with the vertical coordinate $top positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of its bounding box within the window. An "undef" value for $top specifies that the current value of that argument shall be retained unchanged.

•   fitbv ($left)

    Display the page with the horizontal coordinate $left positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of its bounding box within the window. An "undef" value for $left specifies that the current value of that argument shall be retained unchanged.

  goto
    $destination = $destination->goto($page, $location, @args);

A go-to action changes the view to a specified destination (page, location, and magnification factor).

Parameters are as described in "destination".

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

A URI action indicates that a URI -- typically a web page -- should be launched.

  launch
    $destination = $destination->launch($file);

A launch action runs an application or opens or prints a document.

$file contains the path to the application to be launched or the document to be opened or printed.

  pdf
    $destination = $destination->pdf($file, $page_number, $location, @args);

Similar to "goto", but the destination is in a different PDF file located at $file. $page_number is an integer rather than a page object, and the other parameters are as described in "destination".