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