lib/PDF/Imposition/Schemaea4x4.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 27 / 27 CC 2 SCAR 3.4
CC
2
Cov
100%
_do_impose
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« script/pdf-impose.pl ↑ Summary
1 package PDF::Imposition::Schemaea4x4;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 extends 'PDF::Imposition::Schema2x4x2';
6  
7 =head1 NAME
8  
9 PDF::Imposition::Schemaea4x4 - fixed size 16 pages on 2 sheets, with double individual folding
10  
11 =head1 SYNOPSIS
12  
13 use PDF::Imposition::Schemaea4x4;
14 my $imposer = PDF::Imposition::Schemaea4x4->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 2 sheets.
25  
26 This is B<not> suitable for home-printing.
27  
28 Scenario: the sheets are printed. Each sheet is folded B<individually>
29 twice. Then the two folded sheets are inserted one into the other, and
30 finally the signature is bound and trimmed.
31  
32 The bounding, to be stable, has to be done by a dedicated machine.
33  
34 Long story short: if you are not looking exactly for this schema, it's
35 not what you want.
36  
37  
38 +------+------+ +------+------+
39 | | | | | |
40 | r13 | r4 | | r3 | r14 |
41 | | | | | |
42 +------+------+ +------+------+
43 | | | | | |
44 | 16 | 1 | | 2 | 15 |
45 | | | | | |
46 +------+------+ +------+------+
47  
48 +------+------+ +------+------+
49 | | | | | |
50 | r9 | r8 | | r7 | r10 |
51 | | | | | |
52 +------+------+ +------+------+
53 | | | | | |
54 | 12 | 5 | | 6 | 11 |
55 | | | | | |
56 +------+------+ +------+------+
57  
58  
59 To complete the block of 16 logical pages, blank pages are inserted if
60 needed.
61  
62 =cut
63  
64 3 ▶sub _do_impose {
Subroutine _do_impose: called CC=2 SCAR=6.9
65 3 my $self = shift;
66 3 $self->out_pdf_obj->mediabox(
67 $self->orig_width * 2,
68 $self->orig_height * 2,
69 );
70 3 my $total = $self->total_pages;
71 3 my @pages = (1..$total);
72 3 ▶ while (@pages) {
Branch: 1 branch
BranchTrueFalseTotal
if (@pages) 5 3 8
73 5 my ($p1, $p2, $p3, $p4,
74 $p5, $p6, $p7, $p8,
75 $p9, $p10, $p11, $p12,
76 $p13, $p14, $p15, $p16) = splice @pages, 0, 16;
77 # initialize
78 5 $self->_compose_quadruple($p16, $p1, $p4, $p13);
79 5 $self->_compose_quadruple($p2, $p15, $p14, $p3);
80 5 $self->_compose_quadruple($p12, $p5, $p8, $p9 );
81 5 $self->_compose_quadruple($p6, $p11, $p10, $p7);
82 }
83 }
84  
85 3 1;
« script/pdf-impose.pl ↑ Summary