API3/Compat/API2/Resource/XObject/Form/Hybrid.pm

filter: Statementstmt 40.9% 27 / 66 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 9 / 12 Podpod 100% 3 / 3 totaltotal 44.8% 39 / 87 CC 5 SCAR 16.5
CC
5
Cov
38%
new
12.0
outobjdeep
12.0
new_api
2.0
CRAP 5.2
« API3/Compat/API2/Win32.pm ↑ Summary API3/Compat/API2/Basic/TTF/Mort/Noncontextual.pm »
1 #=======================================================================
2 # ____ ____ _____ _ ____ ___ ____
3 # | _ \| _ \| ___| _ _ / \ | _ \_ _| |___ \
4 # | |_) | | | | |_ (_) (_) / _ \ | |_) | | __) |
5 # | __/| |_| | _| _ _ / ___ \| __/| | / __/
6 # |_| |____/|_| (_) (_) /_/ \_\_| |___| |_____|
7 #
8 # A Perl Module Chain to faciliate the Creation and Modification
9 # of High-Quality "Portable Document Format (PDF)" Files.
10 #
11 # Copyright 1999-2005 Alfred Reibenschuh <areibens@cpan.org>.
12 #
13 #=======================================================================
14 #
15 # This library is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU Lesser General Public
17 # License as published by the Free Software Foundation; either
18 # version 2 of the License, or (at your option) any later version.
19 #
20 # This library is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # Lesser General Public License for more details.
24 #
25 # You should have received a copy of the GNU Lesser General Public
26 # License along with this library; if not, write to the
27 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 # Boston, MA 02111-1307, USA.
29 #
30 # $Id: Hybrid.pm,v 2.1 2007/05/08 18:32:10 areibens Exp $
31 #
32 #=======================================================================
33 package PDF::API3::Compat::API2::Resource::XObject::Form::Hybrid;
34
35 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
36
37 1 ▶ use PDF::API3::Compat::API2::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 1 ▶ use PDF::API3::Compat::API2::Basic::PDF::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶ use PDF::API3::Compat::API2::Basic::PDF::Dict;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 1 ▶ use PDF::API3::Compat::API2::Resource::XObject::Form;
Subroutine BEGIN: called CC=1 SCAR=0.0
41
42 1 ▶ use PDF::API3::Compat::API2::Content;
Subroutine BEGIN: called CC=1 SCAR=0.0
43
44 1 ▶ use POSIX;
Subroutine BEGIN: called CC=1 SCAR=0.0
45
46 1 ▶ use vars qw(@ISA $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
47
48 1 @ISA = (
49 'PDF::API3::Compat::API2::Content',
50 'PDF::API3::Compat::API2::Resource::XObject::Form'
51 );
52
53 1 ( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.1 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2007/05/08 18:32:10 $
54 }
55 1 ▶no warnings qw[ deprecated recursion uninitialized ];
Subroutine BEGIN: called CC=1 SCAR=0.0
56
57 =item $res = PDF::API3::Compat::API2::Resource::XObject::Form::Hybrid->new $pdf
58
59 Returns a hybrid-form object.
60
61 =cut
62
63 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
64 0 my ($class,$pdf) = @_;
65 0 my $self;
66
67 0 ▶ $class = ref $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
68
69 0 $self=PDF::API3::Compat::API2::Resource::XObject::Form::new($class,$pdf,pdfkey());
70 0 ▶ $pdf->new_obj($self) unless($self->is_obj($pdf));
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_obj($pdf) 0 0 0
71
72 0 $self->{' apipdf'}=$pdf;
73
74 0 $self->{' stream'}='';
75 0 $self->{' poststream'}='';
76 0 $self->{' font'}=undef;
77 0 $self->{' fontsize'}=0;
78 0 $self->{' charspace'}=0;
79 0 $self->{' hspace'}=100;
80 0 $self->{' wordspace'}=0;
81 0 $self->{' lead'}=0;
82 0 $self->{' rise'}=0;
83 0 $self->{' render'}=0;
84 0 $self->{' matrix'}=[1,0,0,1,0,0];
85 0 $self->{' fillcolor'}=[0];
86 0 $self->{' strokecolor'}=[0];
87 0 $self->{' translate'}=[0,0];
88 0 $self->{' scale'}=[1,1];
89 0 $self->{' skew'}=[0,0];
90 0 $self->{' rotate'}=0;
91 0 $self->{' apiistext'}=0;
92
93 0 $self->{Resources}=PDFDict();
94 0 $self->{Resources}->{ProcSet}=PDFArray(map { PDFName($_) } qw[ PDF Text ImageB ImageC ImageI ]);
95
96 0 $self->compressFlate;
97
98 0 return($self);
99 }
100
101 =item $res = PDF::API3::Compat::API2::Resource::XObject::Form::Hybrid->new_api $api, $name
102
103 Returns a hybrid-form object. This method is different from 'new' that
104 it needs an PDF::API3::Compat::API2-object rather than a Text::PDF::File-object.
105
106 =cut
107
108 0 ▶sub new_api {
Subroutine new_api: not called CC=1 SCAR=6.9
Pod documented
109 0 my ($class,$api,@opts)=@_;
110
111 0 my $obj=$class->new($api->{pdf},@opts);
112 0 $obj->{' api'}=$api;
113
114 0 return($obj);
115 }
116
117 0 ▶sub outobjdeep {
Subroutine outobjdeep: not called CC=3 SCAR=24.8
Pod documented
118 0 my ($self, @opts) = @_;
119 0 ▶ $self->textend unless($self->{' nofilt'});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{" nofilt"} 0 0 0
120 0 foreach my $k (qw/ api apipdf apipage font fontsize charspace hspace wordspace lead rise render matrix fillcolor strokecolor translate scale skew rotate /) {
121 0 $self->{" $k"}=undef;
122 0 delete($self->{" $k"});
123 }
124 0 PDF::API3::Compat::API2::Basic::PDF::Dict::outobjdeep($self,@opts);
125 }
126
127 1 1;
128
129 __END__
« API3/Compat/API2/Win32.pm ↑ Summary API3/Compat/API2/Basic/TTF/Mort/Noncontextual.pm »