2.4.1. Imposition Helpers (layout.pages.imposition)

This module contains utility functions to arrange a set of pages for printing.

The functions in this module aren’t layout managers in their own right: they return lists of layout managers, one per page, given a list of elements to output.

layout.pages.imposition.FORMAT_12_PAGE = (2, 3, [12, 1, 9, 4, 8, 5, 2, 11, 3, 10, 6, 7])

Format three by four pages.

layout.pages.imposition.FORMAT_16_PAGE = (4, 2, [13, 4, 1, 16, 12, 5, 8, 9, 15, 2, 3, 14, 10, 7, 6, 11])

A convenience name for the more normal 16-page-upright format.

layout.pages.imposition.FORMAT_16_PAGE_OBLONG = (2, 4, [9, 8, 12, 5, 13, 4, 16, 1, 7, 10, 6, 11, 3, 14, 2, 15])

Format sixteen pages so the sheet is concertina folded twice along its long direction before being folded the other way. This is often used for landscape-oriented output.

layout.pages.imposition.FORMAT_16_PAGE_UPRIGHT = (4, 2, [13, 4, 1, 16, 12, 5, 8, 9, 15, 2, 3, 14, 10, 7, 6, 11])

Format sixteen pages so that the two folds will be perpendicular.

layout.pages.imposition.FORMAT_24_PAGE = (4, 3, [12, 13, 24, 1, 9, 16, 21, 4, 8, 17, 20, 5, 2, 23, 14, 11, 3, 22, 15, 10, 6, 19, 18, 7])

A six by four layout of pages.

layout.pages.imposition.FORMAT_32_PAGE = (4, 4, [29, 4, 5, 28, 20, 13, 12, 21, 17, 16, 9, 24, 32, 1, 8, 25, 27, 6, 3, 30, 22, 11, 14, 19, 23, 10, 15, 18, 26, 7, 2, 31])

A regular four by eight layout of pages. This assumes the output will have portrait format pages.

layout.pages.imposition.FORMAT_4_PAGE = (2, 1, [4, 1, 2, 3])

Impose four pages in the same orientation as the sheet.

layout.pages.imposition.FORMAT_8_PAGE = (2, 2, [5, 4, 8, 1, 3, 6, 2, 7])

Format two by four pages on a sheet.

layout.pages.imposition.get_page_impositions(imposition_type, sheets_per_sig=None, fold_then_collate=False, thickness=0.2835, signature_mark=0, elements=[])

Calculates impositions for the elements in the content list and returns a set of page-layouts for each as manager instances.

An imposition is a way of laying out pages on a larger sheet, such that they can be folded and cut to form a booklet. The signature size of an imposition controls how many of these large sheets can fold together as one. Larger books are made up of multiple signatures sewn together in a codex.

Arguments:

imposition_type
One of the FORMAT_* constants defined in this module: controls the kind of imposition to make.
sheets_per_sig
How many sheets of paper will be folded, cut and bind together. This is often 1 for commercial presses, but DIY laser printouts often have all the pages in one signature (for stapling). If this value isn’t provided, the function will assume the latter.
fold_then_collate
If this is true then each printed sheet will be folded and cut, then the bundle of resulting pages will be combined with the others from its signature. This kindof defeats the object of printing in signatures, but is needed when building multi-signature books using a laser printer. It only makes sense if you have more than one sheet per sig.
thickness
When many pages are folded together, the thickness of the sheets adds up. Giving a page thickness to this argument moves the printed pages around slightly to compensate.
signature_mark
When working with many signatures, it can be fiddly to sort the signatures into the correct order for binding. To help we can add ‘signature marks’ - a triangle on the spine of each signature indicating up, and offset from signature to signature. When the signatures are correctly collated, the marks form a diagonal pattern: it is obvious when they are not correct. The value of this argument indicates the width of this pattern. Zero indicates that no mark should be added.
elements
The list of individual page element to impose. There can be fewer pages to layout than spaces on the layout (i.e. in a 16 page imposition, we could only have 13 pages), any additional space is left blank.

The returned page layouts can be given to a PageLM for rendering onto individual pages of output. This method isn’t a layout manager in its own right.

layout.pages.imposition.get_pocketmod_pages(elements, page_edge_bottom=True, first_page_vertical=True)

Creates one or more managers that wraps the given elements into one or more Pocket Mod-style page sets. Each manager in the list that is returned corresponds to one page. This imposer is designed to work with portrait oriented content pages, laid out onto a landscape oriented page.

Arguments:

elements
The elements to lay out. PocketMod uses sheets with 8 pages on them, but you can pass in fewer elements - additional space will be left blank. The number of pages output is just the ceiling of the number of pages passed in divided by 8.
page_edge_bottom
If true the pages should be arranged so that, when folded, the bottom of each page touches the edge of the sheet of paper. This is normal, because the edge of the paper is where a normal printer blank-margin is located, and the bottom edge of a page usually has the largest margin.
first_page_vertical
If true then the fold on the first page will be vertical. Each ‘page’ in the book has either a fold on the outside edge or on one of the two horizontal edges (the top edge if page_edge_bottom is set, the bottom otherwise). The horizontal fold keeps the page together more strongly, so is normally used for the first page. The original Pocket Mod software has the first page with a horizontal fold.

The returned page layouts can be given to a PageLM for rendering onto individual pages of output. This method isn’t a layout manager in its own right.