| 1 | package PDF::API2::NamedDestination; | ||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||
| 3 | 38 | ▶ | use base 'PDF::API2::Basic::PDF::Dict'; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||
| 5 | 38 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 6 | 38 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||
| 8 | 38 | our $VERSION = '2.044'; # VERSION | |||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||
| 10 | 38 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 11 | 38 | ▶ | use Encode qw(:all); | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||
| 13 | 38 | ▶ | use PDF::API2::Util; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 14 | 38 | ▶ | use PDF::API2::Basic::PDF::Utils; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||
| 16 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||
| 18 | PDF::API2::NamedDestination - Add named destinations (views) to a PDF | ||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||
| 20 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||
| 22 | =head2 new | ||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||
| 24 | $destination = PDF::API2::NamedDestination->new($pdf, ...); | ||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||
| 26 | Creates a new named destination object. If any additional arguments are | ||||||||||||||||||||||||||||||||||||||||
| 27 | present, they will be passed to C<destination()>. | ||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||
| 29 | =cut | ||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||
| 31 | sub new { | ||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | my $class = shift(); | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | my $pdf = shift(); | |||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | $pdf = $pdf->{'pdf'} if $pdf->isa('PDF::API2'); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | my $self = $class->SUPER::new($pdf); | |||||||||||||||||||||||||||||||||||||||
| 37 | 1 | $pdf->new_obj($self); | |||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | return $self->destination(@_); | |||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||
| 46 | # Deprecated (warning added in 2.031) | ||||||||||||||||||||||||||||||||||||||||
| 47 | sub new_api { | ||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my ($class, $api2) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_api: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | warnings::warnif('deprecated', | |||||||||||||||||||||||||||||||||||||||
| 50 | 'Call to deprecated method new_api; replace with new'); | ||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $destination = $class->new($api2); | |||||||||||||||||||||||||||||||||||||||
| 53 | 0 | return $destination; | |||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||
| 56 | =head2 destination | ||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||
| 58 | $destination = $destination->destination($page, $location, @args); | ||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||
| 60 | A destination is a particular view of a PDF, consisting of a page object, the | ||||||||||||||||||||||||||||||||||||||||
| 61 | location of the window on that page, and possible coordinate and zoom arguments. | ||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||
| 63 | # The XYZ location takes three arguments | ||||||||||||||||||||||||||||||||||||||||
| 64 | my $dest1 = PDF::API2::NamedDestination->new($pdf); | ||||||||||||||||||||||||||||||||||||||||
| 65 | $dest->destination($pdf->open_page(1), 'xyz' => ($x, $y, $zoom)); | ||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||
| 67 | # The Fit location doesn't require any arguments | ||||||||||||||||||||||||||||||||||||||||
| 68 | my $dest2 = PDF::API2::NamedDestination->new($pdf); | ||||||||||||||||||||||||||||||||||||||||
| 69 | $dest->destination($pdf->open_page(2), 'fit'); | ||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||
| 71 | The following locations are available: | ||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||
| 73 | =over | ||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||
| 75 | =item * xyz ($left, $top, $zoom) | ||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||
| 77 | Display the page with the coordinates (C<$left>, C<$top>) positioned at the | ||||||||||||||||||||||||||||||||||||||||
| 78 | upper-left corner of the window and the contents of the page magnified by the | ||||||||||||||||||||||||||||||||||||||||
| 79 | factor C<$zoom>. An C<undef> value for any of the arguments specifies that the | ||||||||||||||||||||||||||||||||||||||||
| 80 | current value of that argument shall be retained unchanged. A zoom factor of 0 | ||||||||||||||||||||||||||||||||||||||||
| 81 | has the same meaning as C<undef>. | ||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||
| 83 | =item * fit | ||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||
| 85 | Display the page with its contents magnified just enough to fit the entire page | ||||||||||||||||||||||||||||||||||||||||
| 86 | within the window both horizontally and vertically. If the required horizontal | ||||||||||||||||||||||||||||||||||||||||
| 87 | and vertical magnification factors are different, use the smaller of the two, | ||||||||||||||||||||||||||||||||||||||||
| 88 | centering the page within the window in the other dimension. | ||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||
| 90 | =item * fith ($top) | ||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||
| 92 | Display the page with the vertical coordinate C<$top> positioned at the top edge | ||||||||||||||||||||||||||||||||||||||||
| 93 | of the window and the contents of the page magnified just enough to fit the | ||||||||||||||||||||||||||||||||||||||||
| 94 | entire width of the page within the window. An C<undef> value for C<$top> | ||||||||||||||||||||||||||||||||||||||||
| 95 | specifies that the current value of that argument shall be retained unchanged. | ||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||
| 97 | =item * fitv ($left) | ||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||
| 99 | Display the page with the horizontal coordinate C<$left> positioned at the left | ||||||||||||||||||||||||||||||||||||||||
| 100 | edge of the window and the contents of the page magnified just enough to fit the | ||||||||||||||||||||||||||||||||||||||||
| 101 | entire height of the page within the window. An C<undef> value for C<$left> | ||||||||||||||||||||||||||||||||||||||||
| 102 | specifies that the current value of that argument shall be retained unchanged. | ||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||
| 104 | =item * fitr ($left, $bottom, $right, $top) | ||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||
| 106 | Display the page with its contents magnified just enough to fit the rectangle | ||||||||||||||||||||||||||||||||||||||||
| 107 | specified by the coordinates C<$left>, C<$bottom>, C<$right>, and C<$top> | ||||||||||||||||||||||||||||||||||||||||
| 108 | entirely within the window both horizontally and vertically. If the required | ||||||||||||||||||||||||||||||||||||||||
| 109 | horizontal and vertical magnification factors are different, use the smaller of | ||||||||||||||||||||||||||||||||||||||||
| 110 | the two, centering the rectangle within the window in the other dimension. | ||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||
| 112 | =item * fitb | ||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||
| 114 | Display the page with its contents magnified just enough to fit its bounding box | ||||||||||||||||||||||||||||||||||||||||
| 115 | entirely within the window both horizontally and vertically. If the required | ||||||||||||||||||||||||||||||||||||||||
| 116 | horizontal and vertical magnification factors are different, use the smaller of | ||||||||||||||||||||||||||||||||||||||||
| 117 | the two, centering the bounding box within the window in the other dimension. | ||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||
| 119 | =item * fitbh ($top) | ||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||
| 121 | Display the page with the vertical coordinate C<$top> positioned at the top edge | ||||||||||||||||||||||||||||||||||||||||
| 122 | of the window and the contents of the page magnified just enough to fit the | ||||||||||||||||||||||||||||||||||||||||
| 123 | entire width of its bounding box within the window. An C<undef> value for | ||||||||||||||||||||||||||||||||||||||||
| 124 | C<$top> specifies that the current value of that argument shall be retained | ||||||||||||||||||||||||||||||||||||||||
| 125 | unchanged. | ||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||
| 127 | =item * fitbv ($left) | ||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||
| 129 | Display the page with the horizontal coordinate C<$left> positioned at the left | ||||||||||||||||||||||||||||||||||||||||
| 130 | edge of the window and the contents of the page magnified just enough to fit the | ||||||||||||||||||||||||||||||||||||||||
| 131 | entire height of its bounding box within the window. An C<undef> value for | ||||||||||||||||||||||||||||||||||||||||
| 132 | C<$left> specifies that the current value of that argument shall be retained | ||||||||||||||||||||||||||||||||||||||||
| 133 | unchanged. | ||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||
| 135 | =back | ||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||
| 137 | =cut | ||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||
| 139 | sub _array { | ||||||||||||||||||||||||||||||||||||||||
| 140 | 7 | ▶ | my $page = shift(); | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
_array: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||
| 141 | 7 | my $location = shift(); | |||||||||||||||||||||||||||||||||||||||
| 142 | return PDFArray($page, PDFName($location), | ||||||||||||||||||||||||||||||||||||||||
| 143 | 7 | ▶ | map { defined($_) ? PDFNum($_) : PDFNull() } @_); | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||
| 146 | sub _destination { | ||||||||||||||||||||||||||||||||||||||||
| 147 | 7 | ▶ | my ($page, $location, @args) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
_destination: called CC=13 SCAR=33.6
| |||||||||||||||||||||||||||||||||||||||||
| 148 | 7 | ▶ | return _array($page, 'XYZ', undef, undef, undef) unless $location; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||
| 150 | 3 | my %arg_counts = ( | |||||||||||||||||||||||||||||||||||||||
| 151 | xyz => 3, | ||||||||||||||||||||||||||||||||||||||||
| 152 | fit => 0, | ||||||||||||||||||||||||||||||||||||||||
| 153 | fith => 1, | ||||||||||||||||||||||||||||||||||||||||
| 154 | fitv => 1, | ||||||||||||||||||||||||||||||||||||||||
| 155 | fitr => 4, | ||||||||||||||||||||||||||||||||||||||||
| 156 | fitb => 0, | ||||||||||||||||||||||||||||||||||||||||
| 157 | fitbh => 1, | ||||||||||||||||||||||||||||||||||||||||
| 158 | fitbv => 1, | ||||||||||||||||||||||||||||||||||||||||
| 159 | ); | ||||||||||||||||||||||||||||||||||||||||
| 160 | 3 | my $arg_count = $arg_counts{$location}; | |||||||||||||||||||||||||||||||||||||||
| 161 | 3 | ▶ | croak "Invalid location $location" unless defined $arg_count; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||
| 163 | 3 | ▶ | if ($arg_count == 0 and @args) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition33%1/3
$arg_count == 0 and @args
MC/DC0%0/2
$arg_count == 0 and @args
$arg_count == 0
@args
Truth table33%1/3
A and B
A= $arg_count == 0B= @args
| |||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | croak "$location doesn't take any arguments"; | |||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||
| 166 | ▶ | elsif ($arg_count == 1 and @args != 1) { | |||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$arg_count == 1 and @args != 1
MC/DC0%0/2
$arg_count == 1 and @args != 1
$arg_count == 1
@args != 1
Truth table33%1/3
A and B
A= $arg_count == 1B= @args != 1
| |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | croak "$location requires one argument"; | |||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||
| 169 | ▶ | elsif ($arg_count == 3 and @args != 3) { | |||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$arg_count == 3 and @args != 3
MC/DC0%0/2
$arg_count == 3 and @args != 3
$arg_count == 3
@args != 3
Truth table33%1/3
A and B
A= $arg_count == 3B= @args != 3
| |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | croak "$location requires three arguments"; | |||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||
| 172 | ▶ | elsif ($arg_count == 4 and @args != 4) { | |||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$arg_count == 4 and @args != 4
MC/DC0%0/2
$arg_count == 4 and @args != 4
$arg_count == 4
@args != 4
Truth table33%1/3
A and B
A= $arg_count == 4B= @args != 4
| |||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | croak "$location requires four arguments"; | |||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||
| 176 | 3 | ▶ | return _array($page, 'XYZ', @args) if $location eq 'xyz'; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 177 | 3 | ▶ | $location =~ s/^fit(.*)$/'Fit' . uc($1 or '')/e; | ||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$1 || ''
MC/DC0%0/1
$1 || ''
$1
Truth table50%1/2
A
A= $1
| |||||||||||||||||||||||||||||||||||||||||
| 178 | 3 | return _array($page, $location, @args); | |||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||
| 181 | sub destination { | ||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | ▶ | my ($self, $page, $location, @args) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
destination: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | $self->{'D'} = _destination($page, $location, @args); | |||||||||||||||||||||||||||||||||||||||
| 184 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||
| 187 | # Deprecated; use destination instead, removing hyphen from location name | ||||||||||||||||||||||||||||||||||||||||
| 188 | sub dest { | ||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | my ($self, $page, %opts) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
dest: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if (ref($page)) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | $opts{'-xyz'} = [undef, undef, undef] unless keys %opts; | ||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | if (defined $opts{'-fit'}) { | ||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $self->{'D'} = _destination($page, 'fit'); | |||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||
| 197 | elsif (defined $opts{'-fith'}) { | ||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $self->{'D'} = _destination($page, 'fith', $opts{'-fith'}); | |||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||
| 200 | elsif (defined $opts{'-fitb'}) { | ||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $self->{'D'} = _destination($page, 'fitb'); | |||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||
| 203 | elsif (defined $opts{'-fitbh'}) { | ||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $self->{'D'} = _destination($page, 'fitbh', $opts{'-fitbh'}); | |||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||
| 206 | elsif (defined $opts{'-fitv'}) { | ||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | $self->{'D'} = _destination($page, 'fitv', $opts{'-fitv'}); | |||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||
| 209 | elsif (defined $opts{'-fitbv'}) { | ||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | $self->{'D'} = _destination($page, 'fitbv', $opts{'-fitbv'}); | |||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||
| 212 | elsif (defined $opts{'-fitr'}) { | ||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $self->{'D'} = _destination($page, 'fitr', @{$opts{'-fitr'}}); | |||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||
| 215 | elsif (defined $opts{'-xyz'}) { | ||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $self->{'D'} = _destination($page, 'xyz', @{$opts{'-xyz'}}); | |||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||
| 223 | =head2 goto | ||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||
| 225 | $destination = $destination->goto($page, $location, @args); | ||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||
| 227 | A go-to action changes the view to a specified destination (page, location, and | ||||||||||||||||||||||||||||||||||||||||
| 228 | magnification factor). | ||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||
| 230 | Parameters are as described in C<destination>. | ||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||
| 232 | =cut | ||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||
| 234 | sub goto { | ||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
goto: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $self->{'S'} = PDFName('GoTo'); | |||||||||||||||||||||||||||||||||||||||
| 237 | 0 | return $self->destination(@_); | |||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||
| 240 | # Deprecated; use goto instead, removing hyphen from location name | ||||||||||||||||||||||||||||||||||||||||
| 241 | sub link { | ||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
link: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $self->{'S'} = PDFName('GoTo'); | |||||||||||||||||||||||||||||||||||||||
| 244 | 0 | return $self->dest(@_); | |||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||
| 247 | =head2 uri | ||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||
| 249 | $destination = $destination->uri($uri); | ||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||
| 251 | A URI action indicates that a URI -- typically a web page -- should be launched. | ||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||
| 253 | =cut | ||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||
| 255 | # Deprecated (renamed) | ||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | sub url { return uri(@_) } | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
url: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||
| 258 | sub uri { | ||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | my ($self, $uri) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
uri: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $self->{'S'} = PDFName('URI'); | |||||||||||||||||||||||||||||||||||||||
| 262 | 0 | $self->{'URI'} = PDFStr($uri); | |||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||
| 267 | =head2 launch | ||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||
| 269 | $destination = $destination->launch($file); | ||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||
| 271 | A launch action runs an application or opens or prints a document. | ||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||
| 273 | C<$file> contains the path to the application to be launched or the document to | ||||||||||||||||||||||||||||||||||||||||
| 274 | be opened or printed. | ||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||
| 276 | =cut | ||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||
| 278 | # Deprecated (renamed) | ||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | sub file { return launch(@_) } | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||
| 281 | sub launch { | ||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | my ($self, $file) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
launch: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $self->{'S'} = PDFName('Launch'); | |||||||||||||||||||||||||||||||||||||||
| 285 | 0 | $self->{'F'} = PDFStr($file); | |||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||
| 290 | =head2 pdf | ||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||
| 292 | $destination = $destination->pdf($file, $page_number, $location, @args); | ||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||
| 294 | Similar to C<goto>, but the destination is in a different PDF file located at | ||||||||||||||||||||||||||||||||||||||||
| 295 | C<$file>. C<$page_number> is an integer rather than a page object, and the | ||||||||||||||||||||||||||||||||||||||||
| 296 | other parameters are as described in C<destination>. | ||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||
| 298 | =cut | ||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||
| 300 | sub pdf { | ||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | my ($self, $file, $page_number, $location, @args) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
pdf: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $self->{'S'} = PDFName('GoToR'); | |||||||||||||||||||||||||||||||||||||||
| 304 | 0 | $self->{'F'} = PDFStr($file); | |||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | return $self->destination(PDFNum($page_number), $location, @args); | |||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||
| 309 | # Deprecated; use pdf instead, removing hyphen from location name | ||||||||||||||||||||||||||||||||||||||||
| 310 | sub pdfile { | ||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | my ($self, $file, $page_number, @args) = @_; | ||||||||||||||||||||||||||||||||||||||
|
Subroutine
pdfile: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self->{'S'} = PDFName('GoToR'); | |||||||||||||||||||||||||||||||||||||||
| 314 | 0 | $self->{'F'} = PDFStr($file); | |||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | return $self->dest(PDFNum($page_number), @args); | |||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||
| 319 | 38 | 1; | |||||||||||||||||||||||||||||||||||||||