line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Literal PDF Object for Dirty Hacks ... |
2
|
|
|
|
|
|
|
package PDF::Builder::Basic::PDF::Literal; |
3
|
|
|
|
|
|
|
|
4
|
37
|
|
|
37
|
|
278
|
use base 'PDF::Builder::Basic::PDF::Objind'; |
|
37
|
|
|
|
|
77
|
|
|
37
|
|
|
|
|
3696
|
|
5
|
|
|
|
|
|
|
|
6
|
37
|
|
|
37
|
|
239
|
use strict; |
|
37
|
|
|
|
|
81
|
|
|
37
|
|
|
|
|
767
|
|
7
|
37
|
|
|
37
|
|
191
|
use warnings; |
|
37
|
|
|
|
|
96
|
|
|
37
|
|
|
|
|
2290
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '3.023'; # VERSION |
10
|
|
|
|
|
|
|
our $LAST_UPDATE = '3.021'; # manually update whenever code is changed |
11
|
|
|
|
|
|
|
|
12
|
37
|
|
|
37
|
|
346
|
use PDF::Builder::Basic::PDF::Filter; |
|
37
|
|
|
|
|
112
|
|
|
37
|
|
|
|
|
1258
|
|
13
|
37
|
|
|
37
|
|
236
|
use PDF::Builder::Basic::PDF::Name; |
|
37
|
|
|
|
|
118
|
|
|
37
|
|
|
|
|
1125
|
|
14
|
37
|
|
|
37
|
|
222
|
use Scalar::Util qw(blessed); |
|
37
|
|
|
|
|
83
|
|
|
37
|
|
|
|
|
24124
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#no warnings qw[ deprecated recursion uninitialized ]; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
PDF::Builder::Basic::PDF::Literal - Literal PDF Object. Inherits from L |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
0
|
|
|
0
|
1
|
|
my ($class, @opts) = @_; |
26
|
0
|
|
|
|
|
|
my ($self); |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
$class = ref($class) if ref($class); |
29
|
0
|
|
|
|
|
|
$self = $class->SUPER::new(@_); |
30
|
0
|
|
|
|
|
|
$self->{' realised'} = 1; |
31
|
0
|
0
|
|
|
|
|
if (scalar @opts > 1) { |
|
|
0
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
$self->{'-isdict'} = 1; |
33
|
0
|
|
|
|
|
|
my %opt = @opts; |
34
|
0
|
|
|
|
|
|
foreach my $k (keys %opt) { |
35
|
0
|
|
|
|
|
|
$self->{$k} = $opt{$k}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} elsif (scalar @opts == 1) { |
38
|
0
|
|
|
|
|
|
$self->{'-literal'} = $opts[0]; |
39
|
|
|
|
|
|
|
} |
40
|
0
|
|
|
|
|
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub outobjdeep { |
44
|
0
|
|
|
0
|
1
|
|
my ($self, $fh, $pdf) = @_; |
45
|
0
|
0
|
|
|
|
|
if ($self->{'-isdict'}) { |
46
|
0
|
0
|
|
|
|
|
if (defined $self->{' stream'}) { |
47
|
0
|
|
|
|
|
|
$self->{'Length'} = length($self->{' stream'}) + 1; |
48
|
|
|
|
|
|
|
} else { |
49
|
0
|
|
|
|
|
|
delete $self->{'Length'}; |
50
|
|
|
|
|
|
|
} |
51
|
0
|
|
|
|
|
|
$fh->print("<< "); |
52
|
0
|
|
|
|
|
|
foreach my $k (sort keys %{$self}) { |
|
0
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
next if $k=~m|^[ \-]|o; |
54
|
0
|
|
|
|
|
|
$fh->print('/'.PDF::Builder::Basic::PDF::Name::string_to_name($k).' '); |
55
|
0
|
0
|
0
|
|
|
|
if (ref($self->{$k}) eq 'ARRAY') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
$fh->print('[' . join(' ',@{$self->{$k}}) . "]\n"); |
|
0
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} elsif (ref($self->{$k}) eq 'HASH') { |
58
|
|
|
|
|
|
|
$fh->print('<<' . |
59
|
|
|
|
|
|
|
join(' ', map { '/'.PDF::Builder::Basic::PDF::Name::string_to_name($_) . |
60
|
0
|
|
|
|
|
|
' ' . $self->{$k}->{$_} } sort keys %{$self->{$k}}) . |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
" >>\n"); |
62
|
|
|
|
|
|
|
} elsif (blessed($self->{$k}) and $self->{$k}->can('outobj')) { |
63
|
0
|
|
|
|
|
|
$self->{$k}->outobj($fh, $pdf); |
64
|
0
|
|
|
|
|
|
$fh->print("\n"); |
65
|
|
|
|
|
|
|
} else { |
66
|
0
|
|
|
|
|
|
$fh->print("$self->{$k}\n"); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
0
|
|
|
|
|
|
$fh->print(">>\n"); |
70
|
0
|
0
|
|
|
|
|
if (defined $self->{' stream'}) { |
71
|
0
|
|
|
|
|
|
$fh->print("stream\n$self->{' stream'}\nendstream"); # next is endobj which has the final cr |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} else { |
74
|
0
|
|
|
|
|
|
$fh->print($self->{'-literal'}); # next is endobj which has the final cr |
75
|
|
|
|
|
|
|
} |
76
|
0
|
|
|
|
|
|
return; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
1
|
|
sub val { return $_[0]; } |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |