line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#=======================================================================
|
2
|
|
|
|
|
|
|
# ____ ____ _____ _ ____ ___ ____
|
3
|
|
|
|
|
|
|
# | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \
|
4
|
|
|
|
|
|
|
# | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) |
|
5
|
|
|
|
|
|
|
# | __/| |_| | _| _ _ / ___ \| __/| | / __/
|
6
|
|
|
|
|
|
|
# |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____|
|
7
|
|
|
|
|
|
|
#
|
8
|
|
|
|
|
|
|
# A Perl Module Chain to faciliate the Creation and Modification
|
9
|
|
|
|
|
|
|
# of High-Quality "Portable Document Format (PDF)" Files.
|
10
|
|
|
|
|
|
|
#
|
11
|
|
|
|
|
|
|
# Copyright 1999-2005 Alfred Reibenschuh .
|
12
|
|
|
|
|
|
|
#
|
13
|
|
|
|
|
|
|
#=======================================================================
|
14
|
|
|
|
|
|
|
#
|
15
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or
|
16
|
|
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
17
|
|
|
|
|
|
|
# License as published by the Free Software Foundation; either
|
18
|
|
|
|
|
|
|
# version 2 of the License, or (at your option) any later version.
|
19
|
|
|
|
|
|
|
#
|
20
|
|
|
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
21
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
23
|
|
|
|
|
|
|
# Lesser General Public License for more details.
|
24
|
|
|
|
|
|
|
#
|
25
|
|
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
26
|
|
|
|
|
|
|
# License along with this library; if not, write to the
|
27
|
|
|
|
|
|
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
28
|
|
|
|
|
|
|
# Boston, MA 02111-1307, USA.
|
29
|
|
|
|
|
|
|
#
|
30
|
|
|
|
|
|
|
# $Id: Outline.pm,v 2.0 2005/11/16 02:16:00 areibens Exp $
|
31
|
|
|
|
|
|
|
#
|
32
|
|
|
|
|
|
|
#=======================================================================
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
package PDF::API3::Compat::API2::Outline;
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
BEGIN {
|
37
|
1
|
|
|
1
|
|
6
|
use strict;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
38
|
1
|
|
|
1
|
|
5
|
use vars qw( @ISA $VERSION);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
39
|
1
|
|
|
1
|
|
6
|
use PDF::API3::Compat::API2::Util;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
207
|
|
40
|
1
|
|
|
1
|
|
7
|
use PDF::API3::Compat::API2::Basic::PDF::Utils;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
121
|
|
41
|
1
|
|
|
1
|
|
6
|
use PDF::API3::Compat::API2::Basic::PDF::Dict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
90
|
|
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
1
|
|
20
|
@ISA = qw(PDF::API3::Compat::API2::Basic::PDF::Dict);
|
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
32
|
( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.0 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2005/11/16 02:16:00 $
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
}
|
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
1
|
|
6
|
no warnings qw[ deprecated recursion uninitialized ];
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1996
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 $otl = PDF::API3::Compat::API2::Outline->new $api,$parent,$prev
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Returns a new outline object (called from $otls->outline).
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub new {
|
58
|
0
|
|
|
0
|
1
|
|
my ($class,$api,$parent,$prev)=@_;
|
59
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new;
|
60
|
0
|
|
|
|
|
|
$self->{' apipdf'}=$api->{pdf};
|
61
|
0
|
|
|
|
|
|
$self->{' api'}=$api;
|
62
|
0
|
0
|
|
|
|
|
$self->{Parent}=$parent if(defined $parent);
|
63
|
0
|
0
|
|
|
|
|
$self->{Prev}=$prev if(defined $prev);
|
64
|
0
|
|
|
|
|
|
return($self);
|
65
|
|
|
|
|
|
|
}
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub parent {
|
68
|
0
|
|
|
0
|
1
|
|
my $self=shift @_;
|
69
|
0
|
0
|
|
|
|
|
if(defined $_[0]) {
|
70
|
0
|
|
|
|
|
|
$self->{Parent}=shift @_;
|
71
|
|
|
|
|
|
|
}
|
72
|
0
|
|
|
|
|
|
return $self->{Parent};
|
73
|
|
|
|
|
|
|
}
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub prev {
|
76
|
0
|
|
|
0
|
0
|
|
my $self=shift @_;
|
77
|
0
|
0
|
|
|
|
|
if(defined $_[0]) {
|
78
|
0
|
|
|
|
|
|
$self->{Prev}=shift @_;
|
79
|
|
|
|
|
|
|
}
|
80
|
0
|
|
|
|
|
|
return $self->{Prev};
|
81
|
|
|
|
|
|
|
}
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub next {
|
84
|
0
|
|
|
0
|
0
|
|
my $self=shift @_;
|
85
|
0
|
0
|
|
|
|
|
if(defined $_[0]) {
|
86
|
0
|
|
|
|
|
|
$self->{Next}=shift @_;
|
87
|
|
|
|
|
|
|
}
|
88
|
0
|
|
|
|
|
|
return $self->{Next};
|
89
|
|
|
|
|
|
|
}
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub first {
|
92
|
0
|
|
|
0
|
0
|
|
my $self=shift @_;
|
93
|
0
|
0
|
0
|
|
|
|
$self->{First}=$self->{' childs'}->[0] if(defined $self->{' childs'} && defined $self->{' childs'}->[0]);
|
94
|
0
|
|
|
|
|
|
return $self->{First} ;
|
95
|
|
|
|
|
|
|
}
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub last {
|
98
|
0
|
|
|
0
|
0
|
|
my $self=shift @_;
|
99
|
0
|
0
|
0
|
|
|
|
$self->{Last}=$self->{' childs'}->[-1] if(defined $self->{' childs'} && defined $self->{' childs'}->[-1]);
|
100
|
0
|
|
|
|
|
|
return $self->{Last};
|
101
|
|
|
|
|
|
|
}
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub count {
|
104
|
0
|
|
|
0
|
0
|
|
my $self=shift @_;
|
105
|
0
|
0
|
|
|
|
|
my $cnt=scalar @{$self->{' childs'}||[]};
|
|
0
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
map { $cnt+=$_->count();} @{$self->{' childs'}};
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
107
|
0
|
0
|
|
|
|
|
$self->{Count}=PDFNum($self->{' closed'} ? -$cnt : $cnt) if($cnt>0);
|
|
|
0
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
return $cnt;
|
109
|
|
|
|
|
|
|
}
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub fix_outline {
|
112
|
0
|
|
|
0
|
0
|
|
my ($self)=@_;
|
113
|
0
|
|
|
|
|
|
$self->first;
|
114
|
0
|
|
|
|
|
|
$self->last;
|
115
|
0
|
|
|
|
|
|
$self->count;
|
116
|
|
|
|
|
|
|
}
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item $otl->title $text
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Set the title of the outline.
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub title {
|
125
|
0
|
|
|
0
|
1
|
|
my ($self,$txt)=@_;
|
126
|
0
|
|
|
|
|
|
$self->{Title}=PDFStr($txt);
|
127
|
0
|
|
|
|
|
|
return($self);
|
128
|
|
|
|
|
|
|
}
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item $otl->closed
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Set the status of the outline to closed.
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub closed {
|
137
|
0
|
|
|
0
|
1
|
|
my $self=shift @_;
|
138
|
0
|
|
|
|
|
|
$self->{' closed'}=1;
|
139
|
0
|
|
|
|
|
|
return $self;
|
140
|
|
|
|
|
|
|
}
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item $otl->open
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Set the status of the outline to open.
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub open {
|
149
|
0
|
|
|
0
|
1
|
|
my $self=shift @_;
|
150
|
0
|
|
|
|
|
|
delete $self->{' closed'};
|
151
|
0
|
|
|
|
|
|
return $self;
|
152
|
|
|
|
|
|
|
}
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item $sotl=$otl->outline
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Returns a new sub-outline.
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub outline {
|
161
|
0
|
|
|
0
|
1
|
|
my $self=shift @_;
|
162
|
0
|
|
|
|
|
|
my $obj=PDF::API3::Compat::API2::Outline->new($self->{' api'},$self);
|
163
|
0
|
0
|
|
|
|
|
$obj->prev($self->{' childs'}->[-1]) if(defined $self->{' childs'});
|
164
|
0
|
0
|
|
|
|
|
$self->{' childs'}->[-1]->next($obj) if(defined $self->{' childs'});
|
165
|
0
|
|
|
|
|
|
push(@{$self->{' childs'}},$obj);
|
|
0
|
|
|
|
|
|
|
166
|
0
|
0
|
|
|
|
|
$self->{' api'}->{pdf}->new_obj($obj) if(!$obj->is_obj($self->{' api'}->{pdf}));
|
167
|
0
|
|
|
|
|
|
return $obj;
|
168
|
|
|
|
|
|
|
}
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item $otl->dest $pageobj [, %opts]
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Sets the destination page of the outline.
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item $otl->dest( $page, -fit => 1 )
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Display the page designated by page, with its contents magnified just enough to
|
177
|
|
|
|
|
|
|
fit the entire page within the window both horizontally and vertically. If the
|
178
|
|
|
|
|
|
|
required horizontal and vertical magnification factors are different, use the
|
179
|
|
|
|
|
|
|
smaller of the two, centering the page within the window in the other dimension.
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=item $otl->dest( $page, -fith => $top )
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Display the page designated by page, with the vertical coordinate top positioned
|
184
|
|
|
|
|
|
|
at the top edge of the window and the contents of the page magnified just enough
|
185
|
|
|
|
|
|
|
to fit the entire width of the page within the window.
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item $otl->dest( $page, -fitv => $left )
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Display the page designated by page, with the horizontal coordinate left positioned
|
190
|
|
|
|
|
|
|
at the left edge of the window and the contents of the page magnified just enough
|
191
|
|
|
|
|
|
|
to fit the entire height of the page within the window.
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item $otl->dest( $page, -fitr => [ $left, $bottom, $right, $top ] )
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Display the page designated by page, with its contents magnified just enough to
|
196
|
|
|
|
|
|
|
fit the rectangle specified by the coordinates left, bottom, right, and top
|
197
|
|
|
|
|
|
|
entirely within the window both horizontally and vertically. If the required
|
198
|
|
|
|
|
|
|
horizontal and vertical magnification factors are different, use the smaller of
|
199
|
|
|
|
|
|
|
the two, centering the rectangle within the window in the other dimension.
|
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item $otl->dest( $page, -fitb => 1 )
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Display the page designated by page, with its contents magnified just
|
204
|
|
|
|
|
|
|
enough to fit its bounding box entirely within the window both horizontally and
|
205
|
|
|
|
|
|
|
vertically. If the required horizontal and vertical magnification factors are
|
206
|
|
|
|
|
|
|
different, use the smaller of the two, centering the bounding box within the
|
207
|
|
|
|
|
|
|
window in the other dimension.
|
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item $otl->dest( $page, -fitbh => $top )
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Display the page designated by page, with the vertical coordinate top
|
212
|
|
|
|
|
|
|
positioned at the top edge of the window and the contents of the page magnified
|
213
|
|
|
|
|
|
|
just enough to fit the entire width of its bounding box within the window.
|
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=item $otl->dest( $page, -fitbv => $left )
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Display the page designated by page, with the horizontal coordinate
|
218
|
|
|
|
|
|
|
left positioned at the left edge of the window and the contents of the page
|
219
|
|
|
|
|
|
|
magnified just enough to fit the entire height of its bounding box within the
|
220
|
|
|
|
|
|
|
window.
|
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=item $otl->dest( $page, -xyz => [ $left, $top, $zoom ] )
|
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Display the page designated by page, with the coordinates (left, top) positioned
|
225
|
|
|
|
|
|
|
at the top-left corner of the window and the contents of the page magnified by
|
226
|
|
|
|
|
|
|
the factor zoom. A zero (0) value for any of the parameters left, top, or zoom
|
227
|
|
|
|
|
|
|
specifies that the current value of that parameter is to be retained unchanged.
|
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=item $otl->dest( $name )
|
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
(PDF 1.2) Connect the Outline to a "Named Destination" defined elswere.
|
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=cut
|
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
sub dest
|
236
|
|
|
|
|
|
|
{
|
237
|
0
|
|
|
0
|
1
|
|
my ($self,$page,%opts)=@_;
|
238
|
|
|
|
|
|
|
|
239
|
0
|
0
|
|
|
|
|
if(ref $page)
|
240
|
|
|
|
|
|
|
{
|
241
|
0
|
0
|
|
|
|
|
$opts{-xyz}=[undef,undef,undef] if(scalar(keys %opts)<1);
|
242
|
|
|
|
|
|
|
|
243
|
0
|
0
|
|
|
|
|
if(defined $opts{-fit})
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
244
|
|
|
|
|
|
|
{
|
245
|
0
|
|
|
|
|
|
$self->{Dest}=PDFArray($page,PDFName('Fit'));
|
246
|
|
|
|
|
|
|
}
|
247
|
|
|
|
|
|
|
elsif(defined $opts{-fith})
|
248
|
|
|
|
|
|
|
{
|
249
|
0
|
|
|
|
|
|
$self->{Dest}=PDFArray($page,PDFName('FitH'),PDFNum($opts{-fith}));
|
250
|
|
|
|
|
|
|
}
|
251
|
|
|
|
|
|
|
elsif(defined $opts{-fitb})
|
252
|
|
|
|
|
|
|
{
|
253
|
0
|
|
|
|
|
|
$self->{Dest}=PDFArray($page,PDFName('FitB'));
|
254
|
|
|
|
|
|
|
}
|
255
|
|
|
|
|
|
|
elsif(defined $opts{-fitbh})
|
256
|
|
|
|
|
|
|
{
|
257
|
0
|
|
|
|
|
|
$self->{Dest}=PDFArray($page,PDFName('FitBH'),PDFNum($opts{-fitbh}));
|
258
|
|
|
|
|
|
|
}
|
259
|
|
|
|
|
|
|
elsif(defined $opts{-fitv})
|
260
|
|
|
|
|
|
|
{
|
261
|
0
|
|
|
|
|
|
$self->{Dest}=PDFArray($page,PDFName('FitV'),PDFNum($opts{-fitv}));
|
262
|
|
|
|
|
|
|
}
|
263
|
|
|
|
|
|
|
elsif(defined $opts{-fitbv})
|
264
|
|
|
|
|
|
|
{
|
265
|
0
|
|
|
|
|
|
$self->{Dest}=PDFArray($page,PDFName('FitBV'),PDFNum($opts{-fitbv}));
|
266
|
|
|
|
|
|
|
}
|
267
|
|
|
|
|
|
|
elsif(defined $opts{-fitr})
|
268
|
|
|
|
|
|
|
{
|
269
|
0
|
0
|
|
|
|
|
die "insufficient parameters to ->dest( page, -fitr => [] ) " unless(scalar @{$opts{-fitr}} == 4);
|
|
0
|
|
|
|
|
|
|
270
|
0
|
|
|
|
|
|
$self->{Dest}=PDFArray($page,PDFName('FitR'),map {PDFNum($_)} @{$opts{-fitr}});
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
}
|
272
|
|
|
|
|
|
|
elsif(defined $opts{-xyz})
|
273
|
|
|
|
|
|
|
{
|
274
|
0
|
0
|
|
|
|
|
die "insufficient parameters to ->dest( page, -xyz => [] ) " unless(scalar @{$opts{-xyz}} == 3);
|
|
0
|
|
|
|
|
|
|
275
|
0
|
0
|
|
|
|
|
$self->{Dest}=PDFArray($page,PDFName('XYZ'),map {defined $_ ? PDFNum($_) : PDFNull()} @{$opts{-xyz}});
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
}
|
277
|
|
|
|
|
|
|
}
|
278
|
|
|
|
|
|
|
else
|
279
|
|
|
|
|
|
|
{
|
280
|
0
|
|
|
|
|
|
$self->{Dest}=PDFStr($page);
|
281
|
|
|
|
|
|
|
}
|
282
|
0
|
|
|
|
|
|
return($self);
|
283
|
|
|
|
|
|
|
}
|
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=item $otl->url $url, %opts
|
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
Defines the outline as launch-url with url $url.
|
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=cut
|
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub url {
|
292
|
0
|
|
|
0
|
1
|
|
my ($self,$url,%opts)=@_;
|
293
|
0
|
|
|
|
|
|
delete $self->{Dest};
|
294
|
0
|
|
|
|
|
|
$self->{A}=PDFDict();
|
295
|
0
|
|
|
|
|
|
$self->{A}->{S}=PDFName('URI');
|
296
|
0
|
|
|
|
|
|
$self->{A}->{URI}=PDFStr($url);
|
297
|
0
|
|
|
|
|
|
return($self);
|
298
|
|
|
|
|
|
|
}
|
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=item $otl->file $file, %opts
|
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
Defines the outline as launch-file with filepath $file.
|
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
=cut
|
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
sub file {
|
307
|
0
|
|
|
0
|
1
|
|
my ($self,$file,%opts)=@_;
|
308
|
0
|
|
|
|
|
|
delete $self->{Dest};
|
309
|
0
|
|
|
|
|
|
$self->{A}=PDFDict();
|
310
|
0
|
|
|
|
|
|
$self->{A}->{S}=PDFName('Launch');
|
311
|
0
|
|
|
|
|
|
$self->{A}->{F}=PDFStr($file);
|
312
|
0
|
|
|
|
|
|
return($self);
|
313
|
|
|
|
|
|
|
}
|
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=item $otl->pdfile $pdfile, $pagenum, %opts
|
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
Defines the destination of the outline as pdf-file with filepath $pdfile, $pagenum
|
318
|
|
|
|
|
|
|
and options %opts (same as dest).
|
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=cut
|
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub pdfile {
|
323
|
0
|
|
|
0
|
1
|
|
my ($self,$file,$pnum,%opts)=@_;
|
324
|
0
|
|
|
|
|
|
delete $self->{Dest};
|
325
|
0
|
|
|
|
|
|
$self->{A}=PDFDict();
|
326
|
0
|
|
|
|
|
|
$self->{A}->{S}=PDFName('GoToR');
|
327
|
0
|
|
|
|
|
|
$self->{A}->{F}=PDFStr($file);
|
328
|
0
|
0
|
|
|
|
|
if(defined $opts{-fit}) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
329
|
0
|
|
|
|
|
|
$self->{A}->{D}=PDFArray(PDFNum($pnum),PDFName('Fit'));
|
330
|
|
|
|
|
|
|
} elsif(defined $opts{-fith}) {
|
331
|
0
|
|
|
|
|
|
$self->{A}->{D}=PDFArray(PDFNum($pnum),PDFName('FitH'),PDFNum($opts{-fith}));
|
332
|
|
|
|
|
|
|
} elsif(defined $opts{-fitb}) {
|
333
|
0
|
|
|
|
|
|
$self->{A}->{D}=PDFArray(PDFNum($pnum),PDFName('FitB'));
|
334
|
|
|
|
|
|
|
} elsif(defined $opts{-fitbh}) {
|
335
|
0
|
|
|
|
|
|
$self->{A}->{D}=PDFArray(PDFNum($pnum),PDFName('FitBH'),PDFNum($opts{-fitbh}));
|
336
|
|
|
|
|
|
|
} elsif(defined $opts{-fitv}) {
|
337
|
0
|
|
|
|
|
|
$self->{A}->{D}=PDFArray(PDFNum($pnum),PDFName('FitV'),PDFNum($opts{-fitv}));
|
338
|
|
|
|
|
|
|
} elsif(defined $opts{-fitbv}) {
|
339
|
0
|
|
|
|
|
|
$self->{A}->{D}=PDFArray(PDFNum($pnum),PDFName('FitBV'),PDFNum($opts{-fitbv}));
|
340
|
|
|
|
|
|
|
} elsif(defined $opts{-fitr}) {
|
341
|
0
|
0
|
|
|
|
|
die "insufficient parameters to ->dest( page, -fitr => [] ) " unless(scalar @{$opts{-fitr}} == 4);
|
|
0
|
|
|
|
|
|
|
342
|
0
|
|
|
|
|
|
$self->{A}->{D}=PDFArray(PDFNum($pnum),PDFName('FitR'),map {PDFNum($_)} @{$opts{-fitr}});
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
} elsif(defined $opts{-xyz}) {
|
344
|
0
|
0
|
|
|
|
|
die "insufficient parameters to dest( page, -xyz => [] ) " unless(scalar @{$opts{-fitr}} == 3);
|
|
0
|
|
|
|
|
|
|
345
|
0
|
|
|
|
|
|
$self->{A}->{D}=PDFArray(PDFNum($pnum),PDFName('XYZ'),map {PDFNum($_)} @{$opts{-xyz}});
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
}
|
347
|
0
|
|
|
|
|
|
return($self);
|
348
|
|
|
|
|
|
|
}
|
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
sub out_obj {
|
351
|
0
|
|
|
0
|
0
|
|
my ($self,@param)=@_;
|
352
|
0
|
|
|
|
|
|
$self->fix_outline;
|
353
|
0
|
|
|
|
|
|
return $self->SUPER::out_obj(@param);
|
354
|
|
|
|
|
|
|
}
|
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
sub outobjdeep {
|
357
|
0
|
|
|
0
|
1
|
|
my ($self,@param)=@_;
|
358
|
0
|
|
|
|
|
|
$self->fix_outline;
|
359
|
0
|
|
|
|
|
|
foreach my $k (qw/ api apipdf apipage /) {
|
360
|
0
|
|
|
|
|
|
$self->{" $k"}=undef;
|
361
|
0
|
|
|
|
|
|
delete($self->{" $k"});
|
362
|
|
|
|
|
|
|
}
|
363
|
0
|
|
|
|
|
|
my @ret=$self->SUPER::outobjdeep(@param);
|
364
|
0
|
|
|
|
|
|
foreach my $k (qw/ First Parent Next Last Prev /) {
|
365
|
0
|
|
|
|
|
|
$self->{$k}=undef;
|
366
|
0
|
|
|
|
|
|
delete($self->{$k});
|
367
|
|
|
|
|
|
|
}
|
368
|
0
|
|
|
|
|
|
return @ret;
|
369
|
|
|
|
|
|
|
}
|
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
1;
|
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
__END__
|