File Coverage

blib/lib/PDF/Imposition/Schema2down.pm
Criterion Covered Total %
statement 24 24 100.0
branch 4 4 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 34 34 100.0


line stmt bran cond sub pod time code
1             package PDF::Imposition::Schema2down;
2 3     3   1789 use strict;
  3         4  
  3         101  
3 3     3   11 use warnings FATAL => 'all';
  3         3  
  3         103  
4              
5 3     3   11 use Moo;
  3         3  
  3         22  
6             extends 'PDF::Imposition::Schema2up';
7              
8             =head1 NAME
9              
10             PDF::Imposition::Schema2down - Imposition schema 2down (booklet with binding on the top)
11              
12             =head1 SYNOPSIS
13              
14             This class inherit everything from L and
15             only alters the C method to rotate the pages by 90 degrees.
16             Please refer to the parent class for method documentation.
17              
18             =head1 SCHEMA EXPLANATION
19              
20             First go and read the schema explanation in
21             L (or better, the whole documentation).
22             It's the same dynamic kind of imposition.
23              
24             The only difference is that each I page is rotated by 90
25             degrees counter-clockwise, so a signature of 4 pages looks so:
26              
27             +------+------+ +------+------+
28             | 4 | 1 | | 2 | 3 |
29             +------+------+ +------+------+
30              
31             Now, showing the number rotated by 90 degrees is a bit complicated in
32             ASCII-art, but each logical page is B, so
33             you have to bind it on the short edge (and the final product will look
34             much more like a notepad than a booklet, as the binding will fall on
35             the top edge).
36              
37             I find this schema odd, but I provide it nevertheless.
38              
39             =cut
40              
41             sub _do_impose {
42 4     4   6 my $self = shift;
43 4         65 $self->out_pdf_obj->mediabox(
44             $self->orig_height * 2,
45             $self->orig_width,
46             );
47 4         435 my $seq = $self->page_sequence_for_booklet;
48 4         11 foreach my $p (@$seq) {
49             # loop over the pages
50 32         4756 my $left = $self->get_imported_page($p->[0]);
51 32         737605 my $right = $self->get_imported_page($p->[1]);
52 32         417069 my $page = $self->out_pdf_obj->page();
53 32         8520 my $gfx = $page->gfx();
54 32         3221 $gfx->transform (
55             -translate => [$self->orig_height, 0],
56             -rotate => 90
57             );
58 32 100       12963 if (defined $left) {
59 29         80 $gfx->formimage($left);
60             }
61 32 100       5716 if (defined $right) {
62 29         81 $gfx->formimage($right, 0, 0 - $self->orig_height);
63             }
64             }
65             }
66              
67             =head1 INTERNALS
68              
69             =head2 cropmarks_options
70              
71             Set twoside to false.
72              
73             =cut
74              
75             sub cropmarks_options {
76 2     2 1 14 my %options = (
77             top => 1,
78             bottom => 1,
79             inner => 1,
80             outer => 1,
81             twoside => 0,
82             );
83 2         20 return %options;
84             }
85              
86             1;
87              
88             =head1 SEE ALSO
89              
90             L
91              
92             =cut
93              
94