line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::Imposition::Schema1repeat2side; |
2
|
3
|
|
|
3
|
|
2249
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
108
|
|
3
|
3
|
|
|
3
|
|
21
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
133
|
|
4
|
3
|
|
|
3
|
|
20
|
use Moo; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
with "PDF::Imposition::Schema"; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
PDF::Imposition::Schema1repeat2side - put two identical pages side by side on the same physical sheet |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use PDF::Imposition::Schema1repeat2side; |
14
|
|
|
|
|
|
|
my $imposer = PDF::Imposition::Schema1repeat2side->new( |
15
|
|
|
|
|
|
|
file => "test.pdf", |
16
|
|
|
|
|
|
|
output => "out.pdf", |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
$imposer->impose; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SCHEMA EXPLANATION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
+-----+-----+ +-----+-----+ |
23
|
|
|
|
|
|
|
| | | | | | |
24
|
|
|
|
|
|
|
| 1 | 1 | | 2 | 2 | |
25
|
|
|
|
|
|
|
| | | | | | |
26
|
|
|
|
|
|
|
+-----+-----+ +-----+-----+ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
The same logical page is inserted twice, side by side, on the same |
29
|
|
|
|
|
|
|
sheet, nothing else. Typical usage scenario: printing A5 leaflets on |
30
|
|
|
|
|
|
|
A4, then cut the sheets vertically. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _do_impose { |
36
|
2
|
|
|
2
|
|
6
|
my $self = shift; |
37
|
2
|
|
|
|
|
42
|
$self->out_pdf_obj->mediabox( |
38
|
|
|
|
|
|
|
$self->orig_width * 2, |
39
|
|
|
|
|
|
|
$self->orig_height, |
40
|
|
|
|
|
|
|
); |
41
|
2
|
|
|
|
|
421
|
foreach my $pageno (1..$self->total_pages) { |
42
|
6
|
|
|
|
|
1675
|
my ($page, $gfx, $chunk); |
43
|
6
|
|
|
|
|
139
|
$page = $self->out_pdf_obj->page; |
44
|
6
|
|
|
|
|
5037
|
$gfx = $page->gfx; |
45
|
6
|
|
|
|
|
1372
|
$chunk = $self->get_imported_page($pageno); |
46
|
6
|
50
|
|
|
|
786997
|
$gfx->formimage($chunk, 0, 0) if $chunk; |
47
|
6
|
|
|
|
|
2661
|
$chunk = $self->get_imported_page($pageno); |
48
|
6
|
50
|
|
|
|
9048
|
$gfx->formimage($chunk, $self->orig_width, 0) if $chunk; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 INTERNALS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 cropmarks_options |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Set twoside to false. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub cropmarks_options { |
61
|
1
|
|
|
1
|
1
|
11
|
my %options = ( |
62
|
|
|
|
|
|
|
top => 1, |
63
|
|
|
|
|
|
|
bottom => 1, |
64
|
|
|
|
|
|
|
inner => 1, |
65
|
|
|
|
|
|
|
outer => 1, |
66
|
|
|
|
|
|
|
# no shifting need |
67
|
|
|
|
|
|
|
twoside => 0, |
68
|
|
|
|
|
|
|
signature => 0, |
69
|
|
|
|
|
|
|
); |
70
|
1
|
|
|
|
|
17
|
return %options; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |