line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::Imposition::Schema1repeat4; |
2
|
3
|
|
|
3
|
|
1701
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
86
|
|
3
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
71
|
|
4
|
3
|
|
|
3
|
|
13
|
use Moo; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
23
|
|
5
|
|
|
|
|
|
|
with "PDF::Imposition::Schema"; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
PDF::Imposition::Schema1repeat4 - put four identical pages on the same physical sheet |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use PDF::Imposition::Schema1repeat4; |
14
|
|
|
|
|
|
|
my $imposer = PDF::Imposition::Schema1repeat4->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
|
|
|
|
|
|
|
| 1 | 1 | | 2 | 2 | |
29
|
|
|
|
|
|
|
| | | | | | |
30
|
|
|
|
|
|
|
+-----+-----+ +-----+-----+ |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
The same logical page is inserted four time, on the same sheet, |
34
|
|
|
|
|
|
|
nothing else. Typical usage scenario: printing A6 leaflets on A4, then |
35
|
|
|
|
|
|
|
cut the sheets vertically and horizontally. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _do_impose { |
41
|
2
|
|
|
2
|
|
7
|
my $self = shift; |
42
|
2
|
|
|
|
|
61
|
$self->out_pdf_obj->mediabox( |
43
|
|
|
|
|
|
|
$self->orig_width * 2, |
44
|
|
|
|
|
|
|
$self->orig_height * 2, |
45
|
|
|
|
|
|
|
); |
46
|
2
|
|
|
|
|
455
|
foreach my $pageno (1..$self->total_pages) { |
47
|
6
|
|
|
|
|
1891
|
my ($page, $gfx, $chunk); |
48
|
6
|
|
|
|
|
154
|
$page = $self->out_pdf_obj->page; |
49
|
6
|
|
|
|
|
3612
|
$gfx = $page->gfx; |
50
|
6
|
|
|
|
|
1334
|
$chunk = $self->get_imported_page($pageno); |
51
|
6
|
50
|
|
|
|
716968
|
$gfx->formimage($chunk, 0, 0) if $chunk; |
52
|
6
|
|
|
|
|
2969
|
$chunk = $self->get_imported_page($pageno); |
53
|
6
|
50
|
|
|
|
9555
|
$gfx->formimage($chunk, $self->orig_width, 0) if $chunk; |
54
|
6
|
|
|
|
|
2614
|
$chunk = $self->get_imported_page($pageno); |
55
|
6
|
50
|
|
|
|
9605
|
$gfx->formimage($chunk, $self->orig_width, $self->orig_height) if $chunk; |
56
|
6
|
|
|
|
|
2658
|
$chunk = $self->get_imported_page($pageno); |
57
|
6
|
50
|
|
|
|
9567
|
$gfx->formimage($chunk, 0, $self->orig_height) if $chunk; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 INTERNALS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 cropmarks_options |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Set twoside to false. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub cropmarks_options { |
71
|
1
|
|
|
1
|
1
|
8
|
my %options = ( |
72
|
|
|
|
|
|
|
top => 1, |
73
|
|
|
|
|
|
|
bottom => 1, |
74
|
|
|
|
|
|
|
inner => 1, |
75
|
|
|
|
|
|
|
outer => 1, |
76
|
|
|
|
|
|
|
# no shifting need |
77
|
|
|
|
|
|
|
twoside => 0, |
78
|
|
|
|
|
|
|
signature => 0, |
79
|
|
|
|
|
|
|
); |
80
|
1
|
|
|
|
|
14
|
return %options; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |