line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::API2::Resource::XObject::Form; |
2
|
|
|
|
|
|
|
|
3
|
38
|
|
|
38
|
|
383
|
use base 'PDF::API2::Resource::XObject'; |
|
38
|
|
|
|
|
109
|
|
|
38
|
|
|
|
|
17326
|
|
4
|
|
|
|
|
|
|
|
5
|
38
|
|
|
38
|
|
263
|
use strict; |
|
38
|
|
|
|
|
88
|
|
|
38
|
|
|
|
|
737
|
|
6
|
38
|
|
|
38
|
|
204
|
use warnings; |
|
38
|
|
|
|
|
97
|
|
|
38
|
|
|
|
|
1450
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.044'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
38
|
|
|
38
|
|
219
|
use PDF::API2::Basic::PDF::Utils; |
|
38
|
|
|
|
|
97
|
|
|
38
|
|
|
|
|
16460
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
PDF::API2::Resource::XObject::Form - Base class for external form objects |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 METHODS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=over |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=item $form = PDF::API2::Resource::XObject::Form->new($pdf) |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Creates a form resource. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
27
|
10
|
|
|
10
|
1
|
30
|
my ($class, $pdf, $name) = @_; |
28
|
10
|
|
|
|
|
63
|
my $self = $class->SUPER::new($pdf, $name); |
29
|
|
|
|
|
|
|
|
30
|
10
|
|
|
|
|
81
|
$self->subtype('Form'); |
31
|
10
|
|
|
|
|
32
|
$self->{'FormType'} = PDFNum(1); |
32
|
|
|
|
|
|
|
|
33
|
10
|
|
|
|
|
30
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item ($llx, $lly, $urx, $ury) = $form->bbox($llx, $lly, $urx, $ury) |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Get or set the coordinates of the form object's bounding box |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub bbox { |
43
|
11
|
|
|
11
|
1
|
38
|
my $self = shift(); |
44
|
|
|
|
|
|
|
|
45
|
11
|
100
|
|
|
|
36
|
if (scalar @_) { |
46
|
10
|
|
|
|
|
25
|
$self->{'BBox'} = PDFArray(map { PDFNum($_) } @_); |
|
40
|
|
|
|
|
91
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
11
|
|
|
|
|
108
|
return map { $_->val() } $self->{'BBox'}->elements(); |
|
44
|
|
|
|
|
135
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item $resource = $form->resource($type, $key) |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item $form->resource($type, $key, $object, $force) |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Get or add a resource required by the form's contents, such as a Font, XObject, ColorSpace, etc. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
By default, an existing C<$key> will not be overwritten. Set C<$force> to override this behavior. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub resource { |
63
|
0
|
|
|
0
|
1
|
|
my ($self, $type, $key, $object, $force) = @_; |
64
|
|
|
|
|
|
|
# we are a self-contained content stream. |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
0
|
|
|
|
$self->{'Resources'} ||= PDFDict(); |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $dict = $self->{'Resources'}; |
69
|
0
|
0
|
|
|
|
|
$dict->realise() if ref($dict) =~ /Objind$/; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
0
|
|
|
|
$dict->{$type} ||= PDFDict(); |
72
|
0
|
0
|
|
|
|
|
$dict->{$type}->realise() if ref($dict->{$type}) =~ /Objind$/; |
73
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
unless (defined $object) { |
75
|
0
|
|
0
|
|
|
|
return $dict->{$type}->{$key} || undef; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
if ($force) { |
79
|
0
|
|
|
|
|
|
$dict->{$type}->{$key} = $object; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
else { |
82
|
0
|
|
0
|
|
|
|
$dict->{$type}->{$key} ||= $object; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return $dict; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=back |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |