File Coverage

blib/lib/PDF/API3/Compat/API2/Resource/XObject/Form/Hybrid.pm
Criterion Covered Total %
statement 26 65 40.0
branch 0 6 0.0
condition n/a
subroutine 9 12 75.0
pod 3 3 100.0
total 38 86 44.1


line stmt bran cond sub pod time code
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 .
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             BEGIN {
36            
37 1     1   7 use PDF::API3::Compat::API2::Util;
  1         3  
  1         249  
38 1     1   6 use PDF::API3::Compat::API2::Basic::PDF::Utils;
  1         3  
  1         147  
39 1     1   7 use PDF::API3::Compat::API2::Basic::PDF::Dict;
  1         3  
  1         23  
40 1     1   744 use PDF::API3::Compat::API2::Resource::XObject::Form;
  1         5  
  1         49  
41            
42 1     1   8 use PDF::API3::Compat::API2::Content;
  1         2  
  1         28  
43            
44 1     1   6 use POSIX;
  1         3  
  1         6  
45            
46 1     1   3207 use vars qw(@ISA $VERSION);
  1         3  
  1         208  
47            
48 1     1   40 @ISA = (
49             'PDF::API3::Compat::API2::Content',
50             'PDF::API3::Compat::API2::Resource::XObject::Form'
51             );
52            
53 1         48 ( $VERSION ) = sprintf '%i.%03i', split(/\./,('$Revision: 2.1 $' =~ /Revision: (\S+)\s/)[0]); # $Date: 2007/05/08 18:32:10 $
54             }
55 1     1   7 no warnings qw[ deprecated recursion uninitialized ];
  1         4  
  1         626  
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             sub new {
64 0     0 1   my ($class,$pdf) = @_;
65 0           my $self;
66            
67 0 0         $class = ref $class if ref $class;
68            
69 0           $self=PDF::API3::Compat::API2::Resource::XObject::Form::new($class,$pdf,pdfkey());
70 0 0         $pdf->new_obj($self) unless($self->is_obj($pdf));
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 ]);
  0            
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             sub new_api {
109 0     0 1   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             sub outobjdeep {
118 0     0 1   my ($self, @opts) = @_;
119 0 0         $self->textend unless($self->{' nofilt'});
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;
128            
129             __END__