line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Literal PDF Object for Dirty Hacks ... |
2
|
|
|
|
|
|
|
package PDF::API2::Basic::PDF::Literal; |
3
|
|
|
|
|
|
|
|
4
|
40
|
|
|
40
|
|
327
|
use base 'PDF::API2::Basic::PDF::Objind'; |
|
40
|
|
|
|
|
97
|
|
|
40
|
|
|
|
|
3957
|
|
5
|
|
|
|
|
|
|
|
6
|
40
|
|
|
40
|
|
280
|
use strict; |
|
40
|
|
|
|
|
87
|
|
|
40
|
|
|
|
|
1557
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.044'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
40
|
|
|
40
|
|
252
|
use PDF::API2::Basic::PDF::Filter; |
|
40
|
|
|
|
|
112
|
|
|
40
|
|
|
|
|
1057
|
|
11
|
40
|
|
|
40
|
|
248
|
use PDF::API2::Basic::PDF::Name; |
|
40
|
|
|
|
|
119
|
|
|
40
|
|
|
|
|
1239
|
|
12
|
40
|
|
|
40
|
|
300
|
use Scalar::Util qw(blessed); |
|
40
|
|
|
|
|
98
|
|
|
40
|
|
|
|
|
2389
|
|
13
|
|
|
|
|
|
|
|
14
|
40
|
|
|
40
|
|
252
|
no warnings qw[ deprecated recursion uninitialized ]; |
|
40
|
|
|
|
|
90
|
|
|
40
|
|
|
|
|
26146
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new |
17
|
|
|
|
|
|
|
{ |
18
|
0
|
|
|
0
|
1
|
|
my ($class, @opts) = @_; |
19
|
0
|
|
|
|
|
|
my ($self); |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
$class = ref $class if ref $class; |
22
|
0
|
|
|
|
|
|
$self = $class->SUPER::new(@_); |
23
|
0
|
|
|
|
|
|
$self->{' realised'} = 1; |
24
|
0
|
0
|
|
|
|
|
if(scalar @opts > 1) { |
|
|
0
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
$self->{-isdict}=1; |
26
|
0
|
|
|
|
|
|
my %opt=@opts; |
27
|
0
|
|
|
|
|
|
foreach my $k (keys %opt) { |
28
|
0
|
|
|
|
|
|
$self->{$k} = $opt{$k}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} elsif(scalar @opts == 1) { |
31
|
0
|
|
|
|
|
|
$self->{-literal}=$opts[0]; |
32
|
|
|
|
|
|
|
} |
33
|
0
|
|
|
|
|
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub outobjdeep |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
0
|
1
|
|
my ($self, $fh, $pdf) = @_; |
39
|
0
|
0
|
|
|
|
|
if($self->{-isdict}) |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
0
|
|
|
|
|
if(defined $self->{' stream'}) |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
|
|
|
$self->{Length} = length($self->{' stream'}) + 1; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
|
|
|
delete $self->{Length}; |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
$fh->print("<< "); |
50
|
0
|
|
|
|
|
|
foreach my $k (sort keys %{$self}) |
|
0
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
{ |
52
|
0
|
0
|
|
|
|
|
next if($k=~m|^[ \-]|o); |
53
|
0
|
|
|
|
|
|
$fh->print('/'.PDF::API2::Basic::PDF::Name::string_to_name($k).' '); |
54
|
0
|
0
|
0
|
|
|
|
if(ref($self->{$k}) eq 'ARRAY') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
|
|
|
$fh->print('['.join(' ',@{$self->{$k}})."]\n"); |
|
0
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
elsif(ref($self->{$k}) eq 'HASH') |
59
|
|
|
|
|
|
|
{ |
60
|
0
|
|
|
|
|
|
$fh->print('<<'.join(' ', map { '/'.PDF::API2::Basic::PDF::Name::string_to_name($_).' '.$self->{$k}->{$_} } sort keys %{$self->{$k}})." >>\n"); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
elsif(blessed($self->{$k}) and $self->{$k}->can('outobj')) |
63
|
|
|
|
|
|
|
{ |
64
|
0
|
|
|
|
|
|
$self->{$k}->outobj($fh, $pdf); |
65
|
0
|
|
|
|
|
|
$fh->print("\n"); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
else |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
|
|
|
$fh->print("$self->{$k}\n"); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
0
|
|
|
|
|
|
$fh->print(">>\n"); |
73
|
0
|
0
|
|
|
|
|
if(defined $self->{' stream'}) |
74
|
|
|
|
|
|
|
{ |
75
|
0
|
|
|
|
|
|
$fh->print("stream\n$self->{' stream'}\nendstream"); # next is endobj which has the final cr |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
else |
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
|
|
|
$fh->print($self->{-literal}); # next is endobj which has the final cr |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub val |
85
|
0
|
|
|
0
|
1
|
|
{ $_[0]; } |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |