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