The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

PDF::Imposition::Schema2up - Imposition schema 2up (booklet)

SYNOPSIS

    use PDF::Imposition::Schema2up;
    my $imposer = PDF::Imposition::Schema2up->new(
                                                  signature => "10-20",
                                                  file => "test.pdf",
                                                  output => "out.pdf",
                                                  cover => 1,
                                                 );
    # or call the methods below to set the values, and then call:
    $imposer->impose;

The output pdf will be in $imposer-output>

SCHEMA EXPLANATION

This schema is a variable and dynamic method. The signature, i.e., the booklets which compose the document, are not fixed-sized, but can be altered. The purpose is to have 1 or more booklets that you print recto-verso and just fold to have your home-made book (this schema is aimed to DIY people).

Say you have a text with 60 pages in A5: you would print it on A4, double-side, take the pile out of the printer, fold it and clip it.

The schema looks like (for a signature of 8 pages on 2 sheets):

       RECTO S.1     VERSO S.1
     +-----+-----+  +-----+-----+ 
     |     |     |  |     |     | 
     |  8  |  1  |  |  2  |  7  | 
     |     |     |  |     |     | 
     +-----+-----+  +-----+-----+ 

       RECTO S.2     VERSO S.2
     +-----+-----+  +-----+-----+
     |     |     |  |     |     |
     |  6  |  3  |  |  4  |  5  |
     |     |     |  |     |     |
     +-----+-----+  +-----+-----+

METHODS

Public methods

signature

The signature, must be a multiple of 4, 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 best the results.

This is useful if you are doing batch processing, and you don't know the number of page in advance (so you can't tweak the source pdf to have a suitable number of page via text-block dimensions or font changes).

Typical case: you define a signature of 60 pages, and your PDF happens to have 61 pages. How unfortunate, and you just can't put out a PDF with 59 blank pages. The manual solution is to change something in the document to get it under 60 pages, but this is not always viable or desirable. So you define a dynamic range for signature, like 20-60, (so the signature will vary between 20 and 60) and the routine will find the best one, which in this particular case happens to be 32 (so the text will have two booklets, and the second will have 3 blank pages).

Es.

  $imposer->signature("20-60");

Keep in mind that a signature with more than 100 pages is not suitable to be printed and folded at home (too thick), so to get some acceptable result, the sheets must be cut and glued together by a binder, so in this case you want to go with the single signature for the whole pdf.

If no signature is specified, the whole text will be imposed on a single signature, regardeless of its size.

cover

This schema supports the cover option.

INTERNALS

pages_per_sheet

Always return 4.

page_sequence_for_booklet($pages, $signature)

Algorithm taken/stolen from psbook (Angus J. C. Duggan 1991-1995). The psutils are still a viable solution if you want to go with the PDF->PS->PDF route.

INTERNALS

cropmarks_options

Set inner to false.

SEE ALSO

PDF::Imposition