line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Khonsu::Form::Field; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
1977
|
use parent 'Khonsu::Text'; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
32
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
325
|
use PDF::API2::Basic::PDF::Utils; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
501
|
|
6
|
5
|
|
|
5
|
|
33
|
use PDF::API2::Basic::PDF::Utils; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
2409
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub attributes { |
9
|
12
|
|
|
12
|
0
|
28
|
my $a = shift; |
10
|
|
|
|
|
|
|
return ( |
11
|
12
|
|
|
|
|
47
|
$a->SUPER::attributes(), |
12
|
|
|
|
|
|
|
xo => { $a->RW, $a->OBJ }, |
13
|
|
|
|
|
|
|
annotate => { $a->RW, $a->OBJ }, |
14
|
|
|
|
|
|
|
name => { $a->RW, $a->STR }, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub add { |
19
|
7
|
|
|
7
|
0
|
27
|
my ($self, $file, %args) = @_; |
20
|
|
|
|
|
|
|
|
21
|
7
|
|
|
|
|
42
|
my %position = $self->get_points(); |
22
|
|
|
|
|
|
|
|
23
|
7
|
|
|
|
|
41
|
my $field = $self->xo( |
24
|
|
|
|
|
|
|
$file->pdf->xo_form() |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
7
|
|
|
|
|
67
|
$self->SUPER::add($file, %args); |
28
|
|
|
|
|
|
|
|
29
|
7
|
|
|
|
|
51
|
my $annotate = $self->annotate( |
30
|
|
|
|
|
|
|
$file->page->current->annotation |
31
|
|
|
|
|
|
|
); |
32
|
7
|
|
|
|
|
49
|
$field->{OpenAction} = PDFArray($self->annotate, PDFName('XYZ'), PDFNull, PDFNull, PDFNum(0)); |
33
|
7
|
|
|
|
|
393
|
$field->bbox(0, 0, 149.8, 14.4); |
34
|
7
|
|
|
|
|
638
|
$annotate->{DR} = $self->font->load(); |
35
|
7
|
|
33
|
|
|
75
|
$annotate->{T} = PDFStr($self->name || $args{text}); |
36
|
7
|
|
|
|
|
153
|
$annotate->{Subtype} = PDFName('Widget'); |
37
|
7
|
|
|
|
|
114
|
$annotate->{P} = $file->page->current; |
38
|
7
|
|
50
|
|
|
66
|
$args{position} ||= \@pps; |
39
|
7
|
50
|
|
|
|
95
|
$self->configure($file, %args) if $self->can('configure'); |
40
|
7
|
|
|
|
|
82
|
$self->set_rect($file, %args); |
41
|
7
|
|
|
|
|
580
|
$file->form->add_to_fields($file, $self->annotate); |
42
|
7
|
|
|
|
|
34
|
return $file; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub set_rect { |
46
|
3
|
|
|
3
|
0
|
16
|
my ($self, $file, %args) = @_; |
47
|
3
|
|
|
|
|
12
|
my %position = $self->get_points(); |
48
|
3
|
|
|
|
|
20
|
$position{y} = $file->page->h - $position{y}; |
49
|
|
|
|
|
|
|
my @pos = ( |
50
|
|
|
|
|
|
|
$self->end_w + 2, |
51
|
|
|
|
|
|
|
$position{y} + ($self->font->size*0.2), |
52
|
|
|
|
|
|
|
$position{w}, |
53
|
3
|
|
|
|
|
19
|
$position{y} - ($self->font->size*1.4) |
54
|
|
|
|
|
|
|
); |
55
|
3
|
|
|
|
|
19
|
$self->annotate->rect(@pos); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |