line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::Imposition::Schema1x8x2; |
2
|
3
|
|
|
3
|
|
2380
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
129
|
|
3
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
118
|
|
4
|
3
|
|
|
3
|
|
19
|
use Moo; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
28
|
|
5
|
|
|
|
|
|
|
with 'PDF::Imposition::Schema'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
PDF::Imposition::Schema1x8x2 - fixed 16 pages signatures on a single sheet, with triple folding. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use PDF::Imposition::Schema1x8x2; |
14
|
|
|
|
|
|
|
my $imposer = PDF::Imposition::Schema1x8x2->new( |
15
|
|
|
|
|
|
|
file => "test.pdf", |
16
|
|
|
|
|
|
|
output => "out.pdf", |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
$imposer->impose; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
The output pdf will be left in C<< $imposer->output >> |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SCHEMA EXPLANATION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Fixed signature size of 16 pages, printed recto-verso on a single sheet. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Typical usage: print A6 on A3, then fold trice, first along the y |
27
|
|
|
|
|
|
|
axys, then the x axys and finally the y axys again. You need to trim |
28
|
|
|
|
|
|
|
the top and right margins before binding. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Not suitable for home-printing because the spine is unstable unless |
31
|
|
|
|
|
|
|
done by a machine. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Visualization (the prefix C means logical page disposed |
34
|
|
|
|
|
|
|
upside-down -- rotated 180 degrees): |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
+------+------+------+------+ |
38
|
|
|
|
|
|
|
| | | | | |
39
|
|
|
|
|
|
|
| r5 | r12 | r9 | r8 | |
40
|
|
|
|
|
|
|
| | | | | |
41
|
|
|
|
|
|
|
+------+------+------+------+ |
42
|
|
|
|
|
|
|
| | | | | |
43
|
|
|
|
|
|
|
| 4 | 13 | 16 | 1 | |
44
|
|
|
|
|
|
|
| | | | | |
45
|
|
|
|
|
|
|
+------+------+------+------+ |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
+------+------+------+------+ |
48
|
|
|
|
|
|
|
| | | | | |
49
|
|
|
|
|
|
|
| r7 | r10 | r11 | r6 | |
50
|
|
|
|
|
|
|
| | | | | |
51
|
|
|
|
|
|
|
+------+------+------+------+ |
52
|
|
|
|
|
|
|
| | | | | |
53
|
|
|
|
|
|
|
| 2 | 15 | 14 | 3 | |
54
|
|
|
|
|
|
|
| | | | | |
55
|
|
|
|
|
|
|
+------+------+------+------+ |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
To complete the block of 16 logical pages, blank pages are inserted if |
59
|
|
|
|
|
|
|
needed. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _do_impose { |
64
|
2
|
|
|
2
|
|
8
|
my $self = shift; |
65
|
|
|
|
|
|
|
# set the mediabox doubling them |
66
|
2
|
|
|
|
|
47
|
$self->out_pdf_obj->mediabox( |
67
|
|
|
|
|
|
|
$self->orig_width * 4, |
68
|
|
|
|
|
|
|
$self->orig_height * 2, |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
# here we work with fixed signatures of 16, with the module |
71
|
2
|
|
|
|
|
429
|
my $total = $self->total_pages; |
72
|
2
|
|
|
|
|
80
|
my @pages = (1..$total); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# loop over the pages and compose the 4 physical pages |
75
|
2
|
|
|
|
|
12
|
while (@pages) { |
76
|
3
|
|
|
|
|
449
|
my ($p1, $p2, $p3, $p4, |
77
|
|
|
|
|
|
|
$p5, $p6, $p7, $p8, |
78
|
|
|
|
|
|
|
$p9, $p10, $p11, $p12, |
79
|
|
|
|
|
|
|
$p13, $p14, $p15, $p16) = splice @pages, 0, 16; |
80
|
3
|
|
|
|
|
20
|
$self->_compose_eight($p4, $p13, $p16, $p1, |
81
|
|
|
|
|
|
|
$p8, $p9, $p12, $p5); |
82
|
3
|
|
|
|
|
1250
|
$self->_compose_eight($p2, $p15, $p14, $p3, |
83
|
|
|
|
|
|
|
$p6, $p11, $p10, $p7); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub _compose_eight { |
89
|
6
|
|
|
6
|
|
26
|
my ($self, @seq) = @_; |
90
|
6
|
|
|
|
|
15
|
my $chunk; |
91
|
6
|
|
|
|
|
144
|
my $page = $self->out_pdf_obj->page; |
92
|
6
|
|
|
|
|
5589
|
my $gfx = $page->gfx; |
93
|
|
|
|
|
|
|
|
94
|
6
|
|
|
|
|
1271
|
$chunk = $self->get_imported_page($seq[0]); |
95
|
6
|
50
|
|
|
|
807963
|
$gfx->formimage($chunk, 0, 0) if $chunk; |
96
|
|
|
|
|
|
|
|
97
|
6
|
|
|
|
|
2645
|
$chunk = $self->get_imported_page($seq[1]); |
98
|
6
|
50
|
|
|
|
55351
|
$gfx->formimage($chunk, $self->orig_width, 0) if $chunk; |
99
|
|
|
|
|
|
|
|
100
|
6
|
|
|
|
|
2416
|
$chunk = $self->get_imported_page($seq[2]); |
101
|
6
|
50
|
|
|
|
47129
|
$gfx->formimage($chunk, $self->orig_width * 2, 0) if $chunk; |
102
|
|
|
|
|
|
|
|
103
|
6
|
|
|
|
|
2450
|
$chunk = $self->get_imported_page($seq[3]); |
104
|
6
|
50
|
|
|
|
52834
|
$gfx->formimage($chunk, $self->orig_width * 3, 0) if $chunk; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# translate |
107
|
6
|
|
|
|
|
2435
|
$gfx->transform ( |
108
|
|
|
|
|
|
|
-translate => [$self->orig_width * 4, |
109
|
|
|
|
|
|
|
$self->orig_height * 2], |
110
|
|
|
|
|
|
|
-rotate => 180, |
111
|
|
|
|
|
|
|
); |
112
|
|
|
|
|
|
|
|
113
|
6
|
|
|
|
|
5345
|
$chunk = $self->get_imported_page($seq[4]); |
114
|
6
|
50
|
|
|
|
61680
|
$gfx->formimage($chunk, 0, 0) if $chunk; |
115
|
|
|
|
|
|
|
|
116
|
6
|
|
|
|
|
2434
|
$chunk = $self->get_imported_page($seq[5]); |
117
|
6
|
50
|
|
|
|
62903
|
$gfx->formimage($chunk, $self->orig_width, 0) if $chunk; |
118
|
|
|
|
|
|
|
|
119
|
6
|
|
|
|
|
2567
|
$chunk = $self->get_imported_page($seq[6]); |
120
|
6
|
50
|
|
|
|
62132
|
$gfx->formimage($chunk, $self->orig_width * 2, 0) if $chunk; |
121
|
|
|
|
|
|
|
|
122
|
6
|
|
|
|
|
2487
|
$chunk = $self->get_imported_page($seq[7]); |
123
|
6
|
50
|
|
|
|
62404
|
$gfx->formimage($chunk, $self->orig_width * 3, 0) if $chunk; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 INTERNALS |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 pages_per_sheet |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Returns 16 |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 cropmarks_options |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Set inner to false and force signature to 16. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
1
|
|
|
1
|
1
|
5
|
sub pages_per_sheet { 16 } |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub cropmarks_options { |
145
|
1
|
|
|
1
|
1
|
13
|
my %options = ( |
146
|
|
|
|
|
|
|
top => 1, |
147
|
|
|
|
|
|
|
bottom => 1, |
148
|
|
|
|
|
|
|
inner => 0, |
149
|
|
|
|
|
|
|
outer => 1, |
150
|
|
|
|
|
|
|
# no shifting need |
151
|
|
|
|
|
|
|
twoside => 1, |
152
|
|
|
|
|
|
|
signature => 16, |
153
|
|
|
|
|
|
|
); |
154
|
1
|
|
|
|
|
21
|
return %options; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
1; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 SEE ALSO |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
L |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|