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   2469 use strict;
  3         8  
  3         125  
3 3     3   17 use warnings FATAL => 'all';
  3         8  
  3         137  
4              
5 3     3   19 use Moo;
  3         6  
  3         32  
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   13 my $self = shift;
43 4         86 $self->out_pdf_obj->mediabox(
44             $self->orig_height * 2,
45             $self->orig_width,
46             );
47 4         790 my $seq = $self->page_sequence_for_booklet;
48 4         15 foreach my $p (@$seq) {
49             # loop over the pages
50 32         9798 my $left = $self->get_imported_page($p->[0]);
51 32         1208325 my $right = $self->get_imported_page($p->[1]);
52 32         695695 my $page = $self->out_pdf_obj->page();
53 32         27439 my $gfx = $page->gfx();
54 32         6791 $gfx->transform (
55             -translate => [$self->orig_height, 0],
56             -rotate => 90
57             );
58 32 100       28021 if (defined $left) {
59 29         124 $gfx->formimage($left);
60             }
61 32 100       11827 if (defined $right) {
62 29         161 $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 18 my %options = (
77             top => 1,
78             bottom => 1,
79             inner => 1,
80             outer => 1,
81             twoside => 0,
82             );
83 2         30 return %options;
84             }
85              
86             1;
87              
88             =head1 SEE ALSO
89              
90             L
91              
92             =cut
93              
94