| 1 | package PDF::Imposition::Schema1repeat2side; | ||||||||||
| 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 | with "PDF::Imposition::Schema"; | |||||||||
| 6 | |||||||||||
| 7 | =head1 NAME | ||||||||||
| 8 | |||||||||||
| 9 | PDF::Imposition::Schema1repeat2side - put two identical pages side by side on the same physical sheet | ||||||||||
| 10 | |||||||||||
| 11 | =head1 SYNOPSIS | ||||||||||
| 12 | |||||||||||
| 13 | use PDF::Imposition::Schema1repeat2side; | ||||||||||
| 14 | my $imposer = PDF::Imposition::Schema1repeat2side->new( | ||||||||||
| 15 | file => "test.pdf", | ||||||||||
| 16 | output => "out.pdf", | ||||||||||
| 17 | ); | ||||||||||
| 18 | $imposer->impose; | ||||||||||
| 19 | |||||||||||
| 20 | =head1 SCHEMA EXPLANATION | ||||||||||
| 21 | |||||||||||
| 22 | +-----+-----+ +-----+-----+ | ||||||||||
| 23 | | | | | | | | ||||||||||
| 24 | | 1 | 1 | | 2 | 2 | | ||||||||||
| 25 | | | | | | | | ||||||||||
| 26 | +-----+-----+ +-----+-----+ | ||||||||||
| 27 | |||||||||||
| 28 | The same logical page is inserted twice, side by side, on the same | ||||||||||
| 29 | sheet, nothing else. Typical usage scenario: printing A5 leaflets on | ||||||||||
| 30 | A4, then cut the sheets vertically. | ||||||||||
| 31 | |||||||||||
| 32 | =cut | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | 2 | ▶ | sub _do_impose { | ||||||||
|
Subroutine
_do_impose: called CC=4 SCAR=14.0
| |||||||||||
| 36 | 2 | my $self = shift; | |||||||||
| 37 | 2 | $self->out_pdf_obj->mediabox( | |||||||||
| 38 | $self->orig_width * 2, | ||||||||||
| 39 | $self->orig_height, | ||||||||||
| 40 | ); | ||||||||||
| 41 | 2 | foreach my $pageno (1..$self->total_pages) { | |||||||||
| 42 | 6 | my ($page, $gfx, $chunk); | |||||||||
| 43 | 6 | $page = $self->out_pdf_obj->page; | |||||||||
| 44 | 6 | $gfx = $page->gfx; | |||||||||
| 45 | 6 | $chunk = $self->get_imported_page($pageno); | |||||||||
| 46 | 6 | ▶ | $gfx->formimage($chunk, 0, 0) if $chunk; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 6 | $chunk = $self->get_imported_page($pageno); | |||||||||
| 48 | 6 | ▶ | $gfx->formimage($chunk, $self->orig_width, 0) if $chunk; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | } | ||||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | =head1 INTERNALS | ||||||||||
| 53 | |||||||||||
| 54 | =head2 cropmarks_options | ||||||||||
| 55 | |||||||||||
| 56 | Set twoside to false. | ||||||||||
| 57 | |||||||||||
| 58 | =cut | ||||||||||
| 59 | |||||||||||
| 60 | 1 | ▶ | sub cropmarks_options { | ||||||||
|
Subroutine
cropmarks_options: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 61 | 1 | my %options = ( | |||||||||
| 62 | top => 1, | ||||||||||
| 63 | bottom => 1, | ||||||||||
| 64 | inner => 1, | ||||||||||
| 65 | outer => 1, | ||||||||||
| 66 | # no shifting need | ||||||||||
| 67 | twoside => 0, | ||||||||||
| 68 | signature => 0, | ||||||||||
| 69 | ); | ||||||||||
| 70 | 1 | return %options; | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 3 | 1; | |||||||||