line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::Imposition::Schema1repeat2side; |
2
|
3
|
|
|
3
|
|
2224
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
99
|
|
3
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
84
|
|
4
|
3
|
|
|
3
|
|
15
|
use Moo; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
23
|
|
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
|
|
8
|
my $self = shift; |
37
|
2
|
|
|
|
|
41
|
$self->out_pdf_obj->mediabox( |
38
|
|
|
|
|
|
|
$self->orig_width * 2, |
39
|
|
|
|
|
|
|
$self->orig_height, |
40
|
|
|
|
|
|
|
); |
41
|
2
|
|
|
|
|
400
|
foreach my $pageno (1..$self->total_pages) { |
42
|
6
|
|
|
|
|
2104
|
my ($page, $gfx, $chunk); |
43
|
6
|
|
|
|
|
200
|
$page = $self->out_pdf_obj->page; |
44
|
6
|
|
|
|
|
4089
|
$gfx = $page->gfx; |
45
|
6
|
|
|
|
|
1650
|
$chunk = $self->get_imported_page($pageno); |
46
|
6
|
50
|
|
|
|
757951
|
$gfx->formimage($chunk, 0, 0) if $chunk; |
47
|
6
|
|
|
|
|
2964
|
$chunk = $self->get_imported_page($pageno); |
48
|
6
|
50
|
|
|
|
10353
|
$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
|
9
|
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
|
|
|
|
|
13
|
return %options; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |