File Coverage

blib/lib/Khonsu/Form/Field/Select.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 31 33 93.9


line stmt bran cond sub pod time code
1             package Khonsu::Form::Field::Select;
2              
3 5     5   34 use parent 'Khonsu::Form::Field';
  5         10  
  5         32  
4              
5 5     5   306 use PDF::API2::Basic::PDF::Literal;
  5         10  
  5         95  
6 5     5   23 use PDF::API2::Basic::PDF::Utils;
  5         10  
  5         1726  
7              
8             sub configure {
9 3     3 0 20 my ($self, $file, %args) = @_;
10 3         11 $self->annotate->{V} = do {
11 3         14 my $s = PDFStr('');
12 3         53 $s->{' isutf'} = PDFBool(1);
13 3         62 $s;
14             };
15 3         27 $self->annotate->{DA} = PDFStr('0 0 0 reg /F3 11 Tf');
16 3         21 $self->annotate->{DV} = $self->annotate->{V};
17 3         15 $self->annotate->{FT} = PDFName('Ch');
18 3         20 $self->annotate->{Ff} = PDFNum(393216);
19             $self->annotate->{Opt} = PDFArray(map {
20 9         79 PDFStr($_)
21 3         15 } @{$args{options}});
  3         10  
22             }
23              
24             sub set_rect {
25 3     3 0 15 my ($self, $file, %args) = @_;
26 3         15 my %position = $self->get_points();
27 3         32 $position{y} = $file->page->h - $position{y};
28             my @pos = (
29             $self->end_w + 2,
30             $position{y} + ($self->font->size*0.4),
31             $position{w},
32 3         24 $position{y} - ($self->font->size*1.2)
33             );
34 3         20 $self->annotate->rect(@pos);
35             }
36              
37             1;