File Coverage

blib/lib/PDF/Imposition/Schema1repeat2top.pm
Criterion Covered Total %
statement 21 21 100.0
branch 2 4 50.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 29 31 93.5


line stmt bran cond sub pod time code
1             package PDF::Imposition::Schema1repeat2top;
2 3     3   2033 use strict;
  3         9  
  3         103  
3 3     3   19 use warnings;
  3         7  
  3         93  
4 3     3   17 use Moo;
  3         7  
  3         25  
5             with "PDF::Imposition::Schema";
6              
7             =head1 NAME
8              
9             PDF::Imposition::Schema1repeat2top - put two identical pages one on the top of each other.
10              
11             =head1 SYNOPSIS
12              
13             use PDF::Imposition::Schema1repeat2top;
14             my $imposer = PDF::Imposition::Schema1repeat2top->new(
15             file => "test.pdf",
16             output => "out.pdf",
17             );
18             $imposer->impose;
19              
20             =head1 SCHEMA EXPLANATION
21              
22             +-----+ +-----+
23             | | | |
24             | 1 | | 2 |
25             | | | |
26             +-----+ +-----+
27             | | | |
28             | 1 | | 2 |
29             | | | |
30             +-----+ +-----+
31              
32             The same logical page is inserted twice, one on the top of each other,
33             on the same sheet, nothing else.
34              
35             =cut
36              
37              
38             sub _do_impose {
39 2     2   7 my $self = shift;
40 2         52 $self->out_pdf_obj->mediabox(
41             $self->orig_width,
42             $self->orig_height * 2,
43             );
44 2         501 foreach my $pageno (1..$self->total_pages) {
45 6         1477 my ($page, $gfx, $chunk);
46 6         151 $page = $self->out_pdf_obj->page;
47 6         3123 $gfx = $page->gfx;
48 6         1204 $chunk = $self->get_imported_page($pageno);
49 6 50       718932 $gfx->formimage($chunk, 0, 0) if $chunk;
50 6         2271 $chunk = $self->get_imported_page($pageno);
51 6 50       7496 $gfx->formimage($chunk, 0, $self->orig_height) if $chunk;
52             }
53             }
54              
55             =head1 INTERNALS
56              
57             =head2 cropmarks_options
58              
59             Set twoside to false.
60              
61             =cut
62              
63             sub cropmarks_options {
64 1     1 1 13 my %options = (
65             top => 1,
66             bottom => 1,
67             inner => 1,
68             outer => 1,
69             # no shifting need
70             twoside => 0,
71             signature => 0,
72             );
73 1         21 return %options;
74             }
75              
76              
77             1;