NAME
PDF::Imposition::Schema - Role for the imposition schemas.
SYNOPSIS
This class provides the shared method for real imposition schemas and can't me called directly.
Consuming classes must provide a _do_impose
method.
use PDF::Imposition;
my $imposer = PDF::Imposition->new(file => "test.pdf",
# either use
outfile => "out.pdf",
# or suffix
suffix => "-2up"
);
$imposer->impose;
or
use PDF::Imposition;
my $imposer = PDF::Imposition->new();
$imposer->file("test.pdf");
$imposer->outfile("out.pdf");
# or
$imposer->suffix("-imp");
$imposer->impose;
METHODS
Read/write accessors
All the following accessors accept an argument, which sets the value.
file
Unsurprisingly, the input file, which must exist.
outfile
The destination file of the imposition. You may prefer to use the suffix method below, which takes care of the filename.
suffix
The suffix of the file. By default, '-imp', so test.pdf imposed will be saved as 'test-imp.pdf'. If test-imp.pdf already exists, it will be replaced merciless.
signature($num_or_range)
The signature, must be a multiple of the pages_per_sheet
option (usually 4 or 8), or a range, like the string "20-100". If a range is selected, the signature is determined heuristically to minimize the white pages left on the last signature. The wider the range, the better the results.
pages_per_sheet
The number of logical pages which fit on a sheet, recto-verso. Default to 1. Subclasses usually change this and ignore your option unless otherwise specified.
title
The title to set in the PDF meta information. Defaults to the basename.
Internal methods accessors
The following methods are used internally but documented for schema's authors.
dimensions
Returns an hashref with the original pdf dimensions in points.
{ w => 800, h => 600 }
orig_width
orig_height
total_pages
Returns the number of pages
in_pdf_obj
Internal usage. It's the PDF::API2 object used as source.
out_pdf_obj
Internal usage. The PDF::API2 object used as output.
get_imported_page($pagenumber)
Retrieve the page form object from the input pdf to the output pdf, and return it. The method return undef if the page is out of range.
impose
Do the job and leave the output in $self->outfile
, cleaning up the internal objects.
output_filename
If outfile is not provided, use the suffix provided and return the filename.
computed_signature
Return the actual number of signature, resolving 0 to the nearer signature.
total_output_pages
Return the computed number of pages of the output, taking in account the signature handling.
DEMOLISH
Object cleanup.
DEBUG
Constant picked from AMW_DEBUG environment.
cropmarks_options
By default, cropmarks are centered and twoside is true.