line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Code in the PDF::API2::Basic::PDF namespace was originally copied from the |
2
|
|
|
|
|
|
|
# Text::PDF distribution. |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Copyright Martin Hosken |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Martin Hosken's code may be used under the terms of the MIT license. |
7
|
|
|
|
|
|
|
# Subsequent versions of the code have the same license as PDF::API2. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package PDF::API2::Basic::PDF::Utils; |
10
|
|
|
|
|
|
|
|
11
|
40
|
|
|
40
|
|
1856
|
use strict; |
|
40
|
|
|
|
|
99
|
|
|
40
|
|
|
|
|
1986
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '2.044'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
PDF::API2::Basic::PDF::Utils - Convenience functions for creating low-level PDF |
18
|
|
|
|
|
|
|
objects |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
A set of utility functions to save the fingers of the PDF library users! |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 FUNCTIONS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
40
|
|
|
40
|
|
17727
|
use PDF::API2::Basic::PDF::Array; |
|
40
|
|
|
|
|
114
|
|
|
40
|
|
|
|
|
1237
|
|
29
|
40
|
|
|
40
|
|
16996
|
use PDF::API2::Basic::PDF::Bool; |
|
40
|
|
|
|
|
113
|
|
|
40
|
|
|
|
|
1188
|
|
30
|
40
|
|
|
40
|
|
18320
|
use PDF::API2::Basic::PDF::Dict; |
|
40
|
|
|
|
|
151
|
|
|
40
|
|
|
|
|
1589
|
|
31
|
40
|
|
|
40
|
|
271
|
use PDF::API2::Basic::PDF::Name; |
|
40
|
|
|
|
|
96
|
|
|
40
|
|
|
|
|
832
|
|
32
|
40
|
|
|
40
|
|
17405
|
use PDF::API2::Basic::PDF::Null; |
|
40
|
|
|
|
|
105
|
|
|
40
|
|
|
|
|
1088
|
|
33
|
40
|
|
|
40
|
|
16713
|
use PDF::API2::Basic::PDF::Number; |
|
40
|
|
|
|
|
105
|
|
|
40
|
|
|
|
|
1134
|
|
34
|
40
|
|
|
40
|
|
242
|
use PDF::API2::Basic::PDF::String; |
|
40
|
|
|
|
|
81
|
|
|
40
|
|
|
|
|
844
|
|
35
|
40
|
|
|
40
|
|
16841
|
use PDF::API2::Basic::PDF::Literal; |
|
40
|
|
|
|
|
124
|
|
|
40
|
|
|
|
|
1092
|
|
36
|
|
|
|
|
|
|
|
37
|
40
|
|
|
40
|
|
257
|
use Exporter; |
|
40
|
|
|
|
|
136
|
|
|
40
|
|
|
|
|
1675
|
|
38
|
40
|
|
|
40
|
|
226
|
use vars qw(@EXPORT @ISA); |
|
40
|
|
|
|
|
81
|
|
|
40
|
|
|
|
|
14179
|
|
39
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
40
|
|
|
|
|
|
|
@EXPORT = qw(PDFBool PDFArray PDFDict PDFName PDFNull |
41
|
|
|
|
|
|
|
PDFNum PDFStr PDFStrHex PDFUtf); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 PDFBool |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Creates a Bool via PDF::API2::Basic::PDF::Bool->new |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub PDFBool { |
50
|
3
|
|
|
3
|
1
|
21
|
return PDF::API2::Basic::PDF::Bool->new(@_); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 PDFArray |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Creates an array via PDF::API2::Basic::PDF::Array->new |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub PDFArray { |
60
|
773
|
|
|
773
|
1
|
2670
|
return PDF::API2::Basic::PDF::Array->new(@_); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 PDFDict |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Creates a dict via PDF::API2::Basic::PDF::Dict->new |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub PDFDict { |
70
|
1095
|
|
|
1095
|
1
|
4446
|
return PDF::API2::Basic::PDF::Dict->new(@_); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 PDFName |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Creates a name via PDF::API2::Basic::PDF::Name->new |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub PDFName { |
80
|
16816
|
|
|
16816
|
1
|
34798
|
return PDF::API2::Basic::PDF::Name->new(@_); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 PDFNull |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Creates a null via PDF::API2::Basic::PDF::Null->new |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub PDFNull { |
90
|
12
|
|
|
12
|
1
|
49
|
return PDF::API2::Basic::PDF::Null->new(@_); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 PDFNum |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Creates a number via PDF::API2::Basic::PDF::Number->new |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub PDFNum { |
100
|
13323
|
|
|
13323
|
1
|
28320
|
return PDF::API2::Basic::PDF::Number->new(@_); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 PDFStr |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Creates a string via PDF::API2::Basic::PDF::String->new |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub PDFStr { |
110
|
185
|
|
|
185
|
1
|
935
|
return PDF::API2::Basic::PDF::String->new(@_); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Deprecated |
114
|
0
|
|
|
0
|
0
|
0
|
sub PDFUtf { return PDFStr(@_) } |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 PDFStrHex |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Creates a hex-string via PDF::API2::Basic::PDF::String->new |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub PDFStrHex { |
123
|
1
|
|
|
1
|
1
|
6
|
my $string = PDF::API2::Basic::PDF::String->new(@_); |
124
|
1
|
|
|
|
|
3
|
$string->{' ishex'} = 1; |
125
|
1
|
|
|
|
|
4
|
return $string; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |