| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
1581
|
use Renard::Curie::Setup; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
|
|
package Renard::Curie::Model::Document::PDF; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: document that represents a PDF file |
|
4
|
|
|
|
|
|
|
$Renard::Curie::Model::Document::PDF::VERSION = '0.002'; |
|
5
|
2
|
|
|
2
|
|
472
|
use Moo; |
|
|
2
|
|
|
|
|
6415
|
|
|
|
2
|
|
|
|
|
11
|
|
|
6
|
2
|
|
|
2
|
|
2921
|
use Renard::Curie::Data::PDF; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
84
|
|
|
7
|
2
|
|
|
2
|
|
1353
|
use Renard::Curie::Model::Page::RenderedFromPNG; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Renard::Curie::Model::Outline; |
|
9
|
|
|
|
|
|
|
use Renard::Curie::Types qw(PageNumber ZoomLevel); |
|
10
|
|
|
|
|
|
|
use Function::Parameters; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
extends qw(Renard::Curie::Model::Document); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
method _build_last_page_number() :ReturnType(PageNumber) { |
|
15
|
|
|
|
|
|
|
my $info = Renard::Curie::Data::PDF::get_mutool_page_info_xml( |
|
16
|
|
|
|
|
|
|
$self->filename |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
return scalar @{ $info->{page} }; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
method get_rendered_page( (PageNumber) :$page_number, (ZoomLevel) :$zoom_level = 1.0 ) { |
|
23
|
|
|
|
|
|
|
my $png_data = Renard::Curie::Data::PDF::get_mutool_pdf_page_as_png( |
|
24
|
|
|
|
|
|
|
$self->filename, $page_number, $zoom_level |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
return Renard::Curie::Model::Page::RenderedFromPNG->new( |
|
28
|
|
|
|
|
|
|
page_number => $page_number, |
|
29
|
|
|
|
|
|
|
png_data => $png_data, |
|
30
|
|
|
|
|
|
|
zoom_level => $zoom_level, |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
method _build_outline() { |
|
35
|
|
|
|
|
|
|
my $outline_data = Renard::Curie::Data::PDF::get_mutool_outline_simple( |
|
36
|
|
|
|
|
|
|
$self->filename |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
return Renard::Curie::Model::Outline->new( items => $outline_data ); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
with qw( |
|
43
|
|
|
|
|
|
|
Renard::Curie::Model::Document::Role::FromFile |
|
44
|
|
|
|
|
|
|
Renard::Curie::Model::Document::Role::Pageable |
|
45
|
|
|
|
|
|
|
Renard::Curie::Model::Document::Role::Renderable |
|
46
|
|
|
|
|
|
|
Renard::Curie::Model::Document::Role::Cacheable |
|
47
|
|
|
|
|
|
|
Renard::Curie::Model::Document::Role::Outlineable |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=pod |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=encoding UTF-8 |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Renard::Curie::Model::Document::PDF - document that represents a PDF file |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 VERSION |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
version 0.002 |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 EXTENDS |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=over 4 |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * L<Renard::Curie::Model::Document> |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=back |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 CONSUMES |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=over 4 |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * L<Renard::Curie::Model::Document::Role::Cacheable> |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * L<Renard::Curie::Model::Document::Role::FromFile> |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * L<Renard::Curie::Model::Document::Role::Outlineable> |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * L<Renard::Curie::Model::Document::Role::Pageable> |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * L<Renard::Curie::Model::Document::Role::Renderable> |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=back |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 METHODS |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 get_rendered_page |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
method get_rendered_page( (PageNumber) :$page_number ) |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
See L<Renard::Curie::Model::Document::Role::Renderable>. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=begin comment |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=method _build_last_page_number |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Retrieves the last page number of the PDF. Currently implemented through |
|
103
|
|
|
|
|
|
|
C<mutool>. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=end comment |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Project Renard |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Project Renard. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
117
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |