| 1 | package PDF::Imposition::Schema2down; | ||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 3 | ▶ | use warnings FATAL => 'all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 3 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | 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<PDF::Imposition::Schema2up> and | ||||||||||
| 15 | only alters the C<impose> 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<PDF::Imposition::Schema2up> (or better, the whole documentation). | ||||||||||
| 22 | It's the same dynamic kind of imposition. | ||||||||||
| 23 | |||||||||||
| 24 | The only difference is that each I<logical> 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<rotated counter-clockwise>, 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 | 4 | ▶ | sub _do_impose { | ||||||||
|
Subroutine
_do_impose: called CC=4 SCAR=13.9
| |||||||||||
| 42 | 4 | my $self = shift; | |||||||||
| 43 | 4 | $self->out_pdf_obj->mediabox( | |||||||||
| 44 | $self->orig_height * 2, | ||||||||||
| 45 | $self->orig_width, | ||||||||||
| 46 | ); | ||||||||||
| 47 | 4 | my $seq = $self->page_sequence_for_booklet; | |||||||||
| 48 | 4 | foreach my $p (@$seq) { | |||||||||
| 49 | # loop over the pages | ||||||||||
| 50 | 32 | my $left = $self->get_imported_page($p->[0]); | |||||||||
| 51 | 32 | my $right = $self->get_imported_page($p->[1]); | |||||||||
| 52 | 32 | my $page = $self->out_pdf_obj->page(); | |||||||||
| 53 | 32 | my $gfx = $page->gfx(); | |||||||||
| 54 | 32 | $gfx->transform ( | |||||||||
| 55 | -translate => [$self->orig_height, 0], | ||||||||||
| 56 | -rotate => 90 | ||||||||||
| 57 | ); | ||||||||||
| 58 | 32 | ▶ | if (defined $left) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | 29 | $gfx->formimage($left); | |||||||||
| 60 | } | ||||||||||
| 61 | 32 | ▶ | if (defined $right) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 29 | $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 | 2 | ▶ | sub cropmarks_options { | ||||||||
|
Subroutine
cropmarks_options: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 76 | 2 | my %options = ( | |||||||||
| 77 | top => 1, | ||||||||||
| 78 | bottom => 1, | ||||||||||
| 79 | inner => 1, | ||||||||||
| 80 | outer => 1, | ||||||||||
| 81 | twoside => 0, | ||||||||||
| 82 | ); | ||||||||||
| 83 | 2 | return %options; | |||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | 3 | 1; | |||||||||
| 87 | |||||||||||
| 88 | =head1 SEE ALSO | ||||||||||
| 89 | |||||||||||
| 90 | L<PDF::Imposition> | ||||||||||
| 91 | |||||||||||
| 92 | =cut | ||||||||||
| 93 | |||||||||||
| 94 | |||||||||||