line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::API2::Lite; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
72402
|
use strict; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
77
|
|
4
|
2
|
|
|
2
|
|
12
|
no warnings qw[ deprecated recursion uninitialized ]; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
133
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '2.043'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
0
|
|
|
|
|
0
|
BEGIN { |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
756
|
use PDF::API2; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
68
|
|
11
|
2
|
|
|
2
|
|
12
|
use PDF::API2::Util; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
286
|
|
12
|
2
|
|
|
2
|
|
15
|
use PDF::API2::Basic::PDF::Utils; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
158
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
15
|
use POSIX qw( ceil floor ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
16
|
|
15
|
2
|
|
|
2
|
|
162
|
use Scalar::Util qw(blessed); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
110
|
|
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
13
|
use vars qw( $hasWeakRef ); |
|
2
|
|
|
0
|
|
4
|
|
|
2
|
|
|
|
|
4258
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 NAME |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
PDF::API2::Lite - (do not use) |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$pdf = PDF::API2::Lite->new; |
28
|
|
|
|
|
|
|
$pdf->page(595,842); |
29
|
|
|
|
|
|
|
$img = $pdf->image('some.jpg'); |
30
|
|
|
|
|
|
|
$font = $pdf->corefont('Times-Roman'); |
31
|
|
|
|
|
|
|
$font = $pdf->ttfont('TimesNewRoman.ttf'); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
This class is unmaintained (since 2007) and should not be used in new code. It |
36
|
|
|
|
|
|
|
combines many of the methods from L and L into a |
37
|
|
|
|
|
|
|
single class but isn't otherwise any easier to use. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
There have been many improvements and clarifications made to the rest of the |
40
|
|
|
|
|
|
|
distribution that aren't reflected here, so the term "Lite" no longer applies. |
41
|
|
|
|
|
|
|
It remains solely for compatibility with existing legacy code. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 METHODS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=over |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item $pdf = PDF::API2::Lite->new |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub new { |
52
|
3
|
|
|
3
|
1
|
2239
|
my $class=shift(@_); |
53
|
3
|
|
|
|
|
10
|
my %opt=@_; |
54
|
3
|
|
|
|
|
8
|
my $self={}; |
55
|
3
|
|
|
|
|
7
|
bless($self,$class); |
56
|
3
|
|
|
|
|
16
|
$self->{api}=PDF::API2->new(@_); |
57
|
3
|
|
|
|
|
753
|
return $self; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item $pdf->page |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item $pdf->page $width,$height |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item $pdf->page $llx, $lly, $urx, $ury |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Opens a new page. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub page { |
71
|
1
|
|
|
1
|
1
|
951
|
my $self=shift; |
72
|
1
|
|
|
|
|
5
|
$self->{page}=$self->{api}->page; |
73
|
1
|
50
|
|
|
|
4
|
$self->{page}->mediabox(@_) if($_[0]); |
74
|
1
|
|
|
|
|
4
|
$self->{gfx}=$self->{page}->gfx; |
75
|
|
|
|
|
|
|
# $self->{gfx}->compressFlate; |
76
|
1
|
|
|
|
|
5
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item $pdf->mediabox $w, $h |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item $pdf->mediabox $llx, $lly, $urx, $ury |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Sets the global mediabox. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub mediabox { |
89
|
1
|
|
|
1
|
1
|
4
|
my ($self,$x1,$y1,$x2,$y2) = @_; |
90
|
1
|
50
|
|
|
|
4
|
if(defined $x2) { |
91
|
0
|
|
|
|
|
0
|
$self->{api}->mediabox($x1,$y1,$x2,$y2); |
92
|
|
|
|
|
|
|
} else { |
93
|
1
|
|
|
|
|
5
|
$self->{api}->mediabox($x1,$y1); |
94
|
|
|
|
|
|
|
} |
95
|
1
|
|
|
|
|
4
|
$self; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item $pdf->saveas $file |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Saves the document (may not be modified later) and |
101
|
|
|
|
|
|
|
deallocates the pdf-structures. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub saveas { |
106
|
1
|
|
|
1
|
1
|
14
|
my ($self,$file)=@_; |
107
|
1
|
50
|
|
|
|
5
|
if($file eq '-') { |
108
|
1
|
|
|
|
|
6
|
return $self->{api}->to_string(); |
109
|
|
|
|
|
|
|
} else { |
110
|
0
|
|
|
|
|
0
|
$self->{api}->save($file); |
111
|
0
|
|
|
|
|
0
|
return $self; |
112
|
|
|
|
|
|
|
} |
113
|
0
|
|
|
|
|
0
|
foreach my $k (keys %{$self}) { |
|
0
|
|
|
|
|
0
|
|
114
|
0
|
0
|
0
|
|
|
0
|
if(blessed($k) and $k->can('release')) { |
|
|
0
|
0
|
|
|
|
|
115
|
0
|
|
|
|
|
0
|
$k->release(1); |
116
|
|
|
|
|
|
|
} elsif(blessed($k) and $k->can('end')) { |
117
|
0
|
|
|
|
|
0
|
$k->end; |
118
|
|
|
|
|
|
|
} |
119
|
0
|
|
|
|
|
0
|
$self->{$k}=undef; |
120
|
0
|
|
|
|
|
0
|
delete($self->{$k}); |
121
|
|
|
|
|
|
|
} |
122
|
0
|
|
|
|
|
0
|
return; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item $font = $pdf->corefont $fontname |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Returns a new or existing adobe core font object. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
B |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
$font = $pdf->corefont('Times-Roman'); |
133
|
|
|
|
|
|
|
$font = $pdf->corefont('Times-Bold'); |
134
|
|
|
|
|
|
|
$font = $pdf->corefont('Helvetica'); |
135
|
|
|
|
|
|
|
$font = $pdf->corefont('ZapfDingbats'); |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub corefont { |
140
|
4
|
|
|
4
|
1
|
1928
|
my ($self,$name,@opts)=@_; |
141
|
4
|
|
|
|
|
18
|
my $obj=$self->{api}->corefont($name,@opts); |
142
|
4
|
|
|
|
|
13
|
return $obj; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item $font = $pdf->ttfont $ttfile |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Returns a new or existing truetype font object. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
B |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
$font = $pdf->ttfont('TimesNewRoman.ttf'); |
152
|
|
|
|
|
|
|
$font = $pdf->ttfont('/fonts/Univers-Bold.ttf'); |
153
|
|
|
|
|
|
|
$font = $pdf->ttfont('../Democratica-SmallCaps.ttf'); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub ttfont { |
158
|
0
|
|
|
0
|
1
|
0
|
my ($self,$file,@opts)=@_; |
159
|
0
|
|
|
|
|
0
|
return $self->{api}->ttfont($file,@opts); |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item $font = $pdf->psfont($ps_file, [%options]) |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Returns a new type1 font object. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
B |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
$font = $pdf->psfont('TimesRoman.pfa', -afmfile => 'TimesRoman.afm', -encode => 'latin1'); |
169
|
|
|
|
|
|
|
$font = $pdf->psfont('/fonts/Univers.pfb', -pfmfile => '/fonts/Univers.pfm', -encode => 'latin2'); |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub psfont { |
174
|
0
|
|
|
0
|
1
|
0
|
my ($self,@args)=@_; |
175
|
0
|
|
|
|
|
0
|
return $self->{api}->psfont(@args); |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
#=item @color = $pdf->color $colornumber [, $lightdark ] |
179
|
|
|
|
|
|
|
# |
180
|
|
|
|
|
|
|
#=item @color = $pdf->color $basecolor [, $lightdark ] |
181
|
|
|
|
|
|
|
# |
182
|
|
|
|
|
|
|
#Returns a color. |
183
|
|
|
|
|
|
|
# |
184
|
|
|
|
|
|
|
#B |
185
|
|
|
|
|
|
|
# |
186
|
|
|
|
|
|
|
# @color = $pdf->color(0); # 50% grey |
187
|
|
|
|
|
|
|
# @color = $pdf->color(0,+4); # 10% grey |
188
|
|
|
|
|
|
|
# @color = $pdf->color(0,-3); # 80% grey |
189
|
|
|
|
|
|
|
# @color = $pdf->color('yellow'); # yellow, fully saturated |
190
|
|
|
|
|
|
|
# @color = $pdf->color('red',+1); # red, +10% white |
191
|
|
|
|
|
|
|
# @color = $pdf->color('green',-2); # green, +20% black |
192
|
|
|
|
|
|
|
# |
193
|
|
|
|
|
|
|
#=cut |
194
|
|
|
|
|
|
|
# |
195
|
|
|
|
|
|
|
#sub color { |
196
|
|
|
|
|
|
|
# my $self=shift @_; |
197
|
|
|
|
|
|
|
# return $self->{api}->businesscolor(@_); |
198
|
|
|
|
|
|
|
#} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item $egs = $pdf->create_egs |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Returns a new extended-graphics-state object. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
B |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
$egs = $pdf->create_egs; |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=cut |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub create_egs { |
211
|
1
|
|
|
1
|
1
|
15
|
my ($self)=@_; |
212
|
1
|
|
|
|
|
7
|
return $self->{api}->egstate; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=item $img = $pdf->image_jpeg $file |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
Returns a new jpeg-image object. |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=cut |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
sub image_jpeg { |
222
|
0
|
|
|
0
|
1
|
|
my ($self,$file)=@_; |
223
|
0
|
|
|
|
|
|
return $self->{api}->image_jpeg($file); |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=item $img = $pdf->image_png $file |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Returns a new png-image object. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=cut |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
sub image_png { |
233
|
0
|
|
|
0
|
1
|
|
my ($self,$file)=@_; |
234
|
0
|
|
|
|
|
|
return $self->{api}->image_png($file); |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=item $img = $pdf->image_tiff $file |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Returns a new tiff-image object. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=cut |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub image_tiff { |
244
|
0
|
|
|
0
|
1
|
|
my ($self,$file)=@_; |
245
|
0
|
|
|
|
|
|
return $self->{api}->image_tiff($file); |
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=item $img = $pdf->image_pnm $file |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
Returns a new pnm-image object. |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=cut |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub image_pnm { |
255
|
0
|
|
|
0
|
1
|
|
my ($self,$file)=@_; |
256
|
0
|
|
|
|
|
|
return $self->{api}->image_pnm($file); |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=item $pdf->savestate |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
Saves the state of the page. |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=cut |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
sub savestate { |
266
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
267
|
0
|
|
|
|
|
|
$self->{gfx}->save; |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=item $pdf->restorestate |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
Restores the state of the page. |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=cut |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
sub restorestate { |
277
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
278
|
0
|
|
|
|
|
|
$self->{gfx}->restore; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=item $pdf->egstate $egs |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
Sets extended-graphics-state. |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=cut |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
sub egstate { |
288
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
289
|
0
|
|
|
|
|
|
$self->{gfx}->egstate(@_); |
290
|
0
|
|
|
|
|
|
return($self); |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=item $pdf->fillcolor $color |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
Sets fillcolor. |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=cut |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub fillcolor { |
300
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
301
|
0
|
|
|
|
|
|
$self->{gfx}->fillcolor(@_); |
302
|
0
|
|
|
|
|
|
return($self); |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=item $pdf->strokecolor $color |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
Sets strokecolor. |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
B |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, |
312
|
|
|
|
|
|
|
blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, |
313
|
|
|
|
|
|
|
cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen, darkgrey, |
314
|
|
|
|
|
|
|
darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, |
315
|
|
|
|
|
|
|
darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, |
316
|
|
|
|
|
|
|
deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, |
317
|
|
|
|
|
|
|
fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, |
318
|
|
|
|
|
|
|
hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, |
319
|
|
|
|
|
|
|
lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgreen, lightgrey, |
320
|
|
|
|
|
|
|
lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, |
321
|
|
|
|
|
|
|
lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, |
322
|
|
|
|
|
|
|
mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, |
323
|
|
|
|
|
|
|
mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, |
324
|
|
|
|
|
|
|
navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, |
325
|
|
|
|
|
|
|
paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, |
326
|
|
|
|
|
|
|
red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, |
327
|
|
|
|
|
|
|
silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, |
328
|
|
|
|
|
|
|
thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
or the rgb-hex-notation: |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
#rgb, #rrggbb, #rrrgggbbb and #rrrrggggbbbb |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
or the cmyk-hex-notation: |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
%cmyk, %ccmmyykk, %cccmmmyyykkk and %ccccmmmmyyyykkkk |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
or the hsl-hex-notation: |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
&hsl, &hhssll, &hhhssslll and &hhhhssssllll |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
and additionally the hsv-hex-notation: |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
!hsv, !hhssvv, !hhhsssvvv and !hhhhssssvvvv |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
=cut |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
sub strokecolor { |
349
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
350
|
0
|
|
|
|
|
|
$self->{gfx}->strokecolor(@_); |
351
|
0
|
|
|
|
|
|
return($self); |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
=item $pdf->linedash @dash |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
Sets linedash. |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=cut |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
sub linedash { |
361
|
0
|
|
|
0
|
1
|
|
my ($self,@a)=@_; |
362
|
0
|
|
|
|
|
|
$self->{gfx}->linedash(@a); |
363
|
0
|
|
|
|
|
|
return($self); |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
=item $pdf->linewidth $width |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
Sets linewidth. |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=cut |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
sub linewidth { |
373
|
0
|
|
|
0
|
1
|
|
my ($self,$linewidth)=@_; |
374
|
0
|
|
|
|
|
|
$self->{gfx}->linewidth($linewidth); |
375
|
0
|
|
|
|
|
|
return($self); |
376
|
|
|
|
|
|
|
} |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
=item $pdf->transform %opts |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
Sets transformations (eg. translate, rotate, scale, skew) in pdf-canonical order. |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
B |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
$pdf->transform( |
385
|
|
|
|
|
|
|
-translate => [$x,$y], |
386
|
|
|
|
|
|
|
-rotate => $rot, |
387
|
|
|
|
|
|
|
-scale => [$sx,$sy], |
388
|
|
|
|
|
|
|
-skew => [$sa,$sb], |
389
|
|
|
|
|
|
|
) |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=cut |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
sub transform { |
394
|
0
|
|
|
0
|
1
|
|
my ($self,%opt)=@_; |
395
|
0
|
|
|
|
|
|
$self->{gfx}->transform(%opt); |
396
|
0
|
|
|
|
|
|
return($self); |
397
|
|
|
|
|
|
|
} |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=item $pdf->move $x, $y |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=cut |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
sub move { # x,y ... |
404
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
405
|
0
|
|
|
|
|
|
$self->{gfx}->move(@_); |
406
|
0
|
|
|
|
|
|
return($self); |
407
|
|
|
|
|
|
|
} |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=item $pdf->line $x, $y |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
=cut |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
sub line { # x,y ... |
414
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
415
|
0
|
|
|
|
|
|
$self->{gfx}->line(@_); |
416
|
0
|
|
|
|
|
|
return($self); |
417
|
|
|
|
|
|
|
} |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
=item $pdf->curve $x1, $y1, $x2, $y2, $x3, $y3 |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=cut |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
sub curve { # x1,y1,x2,y2,x3,y3 ... |
424
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
425
|
0
|
|
|
|
|
|
$self->{gfx}->curve(@_); |
426
|
0
|
|
|
|
|
|
return($self); |
427
|
|
|
|
|
|
|
} |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=item $pdf->arc $x, $y, $a, $b, $alfa, $beta, $move |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=cut |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
sub arc { # x,y,a,b,alf,bet[,mov] |
434
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
435
|
0
|
|
|
|
|
|
$self->{gfx}->arc(@_); |
436
|
0
|
|
|
|
|
|
return($self); |
437
|
|
|
|
|
|
|
} |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=item $pdf->ellipse $x, $y, $a, $b |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
=cut |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
sub ellipse { |
444
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
445
|
0
|
|
|
|
|
|
$self->{gfx}->ellipse(@_); |
446
|
0
|
|
|
|
|
|
return($self); |
447
|
|
|
|
|
|
|
} |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=item $pdf->circle $x, $y, $r |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=cut |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
sub circle { |
454
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
455
|
0
|
|
|
|
|
|
$self->{gfx}->circle(@_); |
456
|
0
|
|
|
|
|
|
return($self); |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
=item $pdf->rect $x,$y, $w,$h |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=cut |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
sub rect { # x,y,w,h ... |
464
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
465
|
0
|
|
|
|
|
|
$self->{gfx}->rect(@_); |
466
|
0
|
|
|
|
|
|
return($self); |
467
|
|
|
|
|
|
|
} |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=item $pdf->rectxy $x1,$y1, $x2,$y2 |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=cut |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
sub rectxy { |
474
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
475
|
0
|
|
|
|
|
|
$self->{gfx}->rectxy(@_); |
476
|
0
|
|
|
|
|
|
return($self); |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
=item $pdf->poly $x1,$y1, ..., $xn,$yn |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
=cut |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
sub poly { |
484
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
485
|
0
|
|
|
|
|
|
$self->{gfx}->poly(@_); |
486
|
0
|
|
|
|
|
|
return($self); |
487
|
|
|
|
|
|
|
} |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
=item $pdf->close |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
=cut |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
sub close { |
494
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
495
|
0
|
|
|
|
|
|
$self->{gfx}->close; |
496
|
0
|
|
|
|
|
|
return($self); |
497
|
|
|
|
|
|
|
} |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
=item $pdf->stroke |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=cut |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
sub stroke { |
504
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
505
|
0
|
|
|
|
|
|
$self->{gfx}->stroke; |
506
|
0
|
|
|
|
|
|
return($self); |
507
|
|
|
|
|
|
|
} |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=item $pdf->fill |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
=cut |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
sub fill { # nonzero |
514
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
515
|
0
|
|
|
|
|
|
$self->{gfx}->fill; |
516
|
0
|
|
|
|
|
|
return($self); |
517
|
|
|
|
|
|
|
} |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=item $pdf->fillstroke |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
=cut |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
sub fillstroke { # nonzero |
524
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
525
|
0
|
|
|
|
|
|
$self->{gfx}->fillstroke; |
526
|
0
|
|
|
|
|
|
return($self); |
527
|
|
|
|
|
|
|
} |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
=item $pdf->image $imgobj, $x,$y, $w,$h |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
=item $pdf->image $imgobj, $x,$y, $scale |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
=item $pdf->image $imgobj, $x,$y |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
B The width/height or scale given |
536
|
|
|
|
|
|
|
is in user-space coordinates which is subject to |
537
|
|
|
|
|
|
|
transformations which may have been specified beforehand. |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
Per default this has a 72dpi resolution, so if you want an |
540
|
|
|
|
|
|
|
image to have a 150 or 300dpi resolution, you should specify |
541
|
|
|
|
|
|
|
a scale of 72/150 (or 72/300) or adjust width/height accordingly. |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=cut |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
sub image { |
546
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
547
|
0
|
|
|
|
|
|
$self->{gfx}->image(@_); |
548
|
0
|
|
|
|
|
|
return($self); |
549
|
|
|
|
|
|
|
} |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
=item $pdf->textstart |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
=cut |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
sub textstart { |
556
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
557
|
0
|
|
|
|
|
|
$self->{gfx}->textstart; |
558
|
0
|
|
|
|
|
|
return($self); |
559
|
|
|
|
|
|
|
} |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
=item $pdf->textfont $fontobj,$size |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=cut |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
sub textfont { |
566
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
567
|
0
|
|
|
|
|
|
$self->{gfx}->font(@_); |
568
|
0
|
|
|
|
|
|
return($self); |
569
|
|
|
|
|
|
|
} |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
=item $txt->textleading $leading |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
=cut |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
# Deprecated: leading is the correct term for this operator |
576
|
0
|
|
|
0
|
0
|
|
sub textlead { return textleading(@_) } |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
sub textleading { |
579
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
580
|
0
|
|
|
|
|
|
$self->{gfx}->leading(@_); |
581
|
0
|
|
|
|
|
|
return($self); |
582
|
|
|
|
|
|
|
} |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
=item $pdf->text $string |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
Applies the given text. |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
=cut |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
sub text { |
591
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
592
|
0
|
|
0
|
|
|
|
return $self->{gfx}->text(@_)||$self; |
593
|
|
|
|
|
|
|
} |
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
=item $pdf->nl |
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
=cut |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
sub nl { |
600
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
601
|
0
|
|
|
|
|
|
$self->{gfx}->nl; |
602
|
0
|
|
|
|
|
|
return($self); |
603
|
|
|
|
|
|
|
} |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
=item $pdf->textend |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
=cut |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
sub textend { |
610
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
611
|
0
|
|
|
|
|
|
$self->{gfx}->textend; |
612
|
0
|
|
|
|
|
|
return($self); |
613
|
|
|
|
|
|
|
} |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
=item $pdf->print $font, $size, $x, $y, $rot, $just, $text |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
Convenience wrapper for shortening the textstart..textend sequence. |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
=cut |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
sub print { |
622
|
0
|
|
|
0
|
1
|
|
my $self=shift @_; |
623
|
0
|
|
|
|
|
|
my ($font, $size, $x, $y, $rot, $just, @text)=@_; |
624
|
0
|
|
|
|
|
|
my $text=join(' ',@text); |
625
|
0
|
|
|
|
|
|
$self->textstart; |
626
|
0
|
|
|
|
|
|
$self->textfont($font, $size); |
627
|
0
|
|
|
|
|
|
$self->transform( |
628
|
|
|
|
|
|
|
-translate=>[$x, $y], |
629
|
|
|
|
|
|
|
-rotate=> $rot, |
630
|
|
|
|
|
|
|
); |
631
|
0
|
0
|
|
|
|
|
if($just==1) { |
|
|
0
|
|
|
|
|
|
632
|
0
|
|
|
|
|
|
$self->{gfx}->text_center($text); |
633
|
|
|
|
|
|
|
} elsif($just==2) { |
634
|
0
|
|
|
|
|
|
$self->{gfx}->text_right($text); |
635
|
|
|
|
|
|
|
} else { |
636
|
0
|
|
|
|
|
|
$self->text(@text); |
637
|
|
|
|
|
|
|
} |
638
|
0
|
|
|
|
|
|
$self->textend; |
639
|
0
|
|
|
|
|
|
return($self); |
640
|
|
|
|
|
|
|
} |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
1; |
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
__END__ |