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   36 use parent 'Khonsu::Form::Field';
  5         10  
  5         29  
4              
5 5     5   293 use PDF::API2::Basic::PDF::Literal;
  5         11  
  5         144  
6 5     5   24 use PDF::API2::Basic::PDF::Utils;
  5         8  
  5         1737  
7              
8             sub configure {
9 3     3 0 19 my ($self, $file, %args) = @_;
10 3         11 $self->annotate->{V} = do {
11 3         16 my $s = PDFStr('');
12 3         52 $s->{' isutf'} = PDFBool(1);
13 3         55 $s;
14             };
15 3         22 $self->annotate->{DA} = PDFStr('0 0 0 reg /F3 11 Tf');
16 3         24 $self->annotate->{DV} = $self->annotate->{V};
17 3         14 $self->annotate->{FT} = PDFName('Ch');
18 3         11 $self->annotate->{Ff} = PDFNum(393216);
19             $self->annotate->{Opt} = PDFArray(map {
20 9         80 PDFStr($_)
21 3         18 } @{$args{options}});
  3         12  
22             }
23              
24             sub set_rect {
25 3     3 0 16 my ($self, $file, %args) = @_;
26 3         15 my %position = $self->get_points();
27 3         22 $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         33 $position{y} - ($self->font->size*1.2)
33             );
34 3         20 $self->annotate->rect(@pos);
35             }
36              
37             1;