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
|
|
1627
|
use strict; |
|
40
|
|
|
|
|
89
|
|
|
40
|
|
|
|
|
2128
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '2.043'; # 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
|
|
17926
|
use PDF::API2::Basic::PDF::Array; |
|
40
|
|
|
|
|
115
|
|
|
40
|
|
|
|
|
1332
|
|
29
|
40
|
|
|
40
|
|
18984
|
use PDF::API2::Basic::PDF::Bool; |
|
40
|
|
|
|
|
120
|
|
|
40
|
|
|
|
|
1260
|
|
30
|
40
|
|
|
40
|
|
19733
|
use PDF::API2::Basic::PDF::Dict; |
|
40
|
|
|
|
|
140
|
|
|
40
|
|
|
|
|
1685
|
|
31
|
40
|
|
|
40
|
|
313
|
use PDF::API2::Basic::PDF::Name; |
|
40
|
|
|
|
|
97
|
|
|
40
|
|
|
|
|
779
|
|
32
|
40
|
|
|
40
|
|
19792
|
use PDF::API2::Basic::PDF::Null; |
|
40
|
|
|
|
|
103
|
|
|
40
|
|
|
|
|
1167
|
|
33
|
40
|
|
|
40
|
|
16865
|
use PDF::API2::Basic::PDF::Number; |
|
40
|
|
|
|
|
106
|
|
|
40
|
|
|
|
|
1163
|
|
34
|
40
|
|
|
40
|
|
248
|
use PDF::API2::Basic::PDF::String; |
|
40
|
|
|
|
|
98
|
|
|
40
|
|
|
|
|
792
|
|
35
|
40
|
|
|
40
|
|
17803
|
use PDF::API2::Basic::PDF::Literal; |
|
40
|
|
|
|
|
108
|
|
|
40
|
|
|
|
|
1208
|
|
36
|
|
|
|
|
|
|
|
37
|
40
|
|
|
40
|
|
267
|
use Exporter; |
|
40
|
|
|
|
|
82
|
|
|
40
|
|
|
|
|
1762
|
|
38
|
40
|
|
|
40
|
|
228
|
use vars qw(@EXPORT @ISA); |
|
40
|
|
|
|
|
99
|
|
|
40
|
|
|
|
|
14249
|
|
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
|
18
|
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
|
2857
|
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
|
4738
|
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
|
34475
|
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
|
58
|
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
|
27928
|
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
|
936
|
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; |