Chapter 9
Multipage Facilities

cpdf -twoup-stack [-fast] in.pdf -o out.pdf

cpdf -twoup [-fast] in.pdf -o out.pdf

cpdf -pad-before in.pdf [<range>] [-pad-with pad.pdf] -o out.pdf

cpdf -pad-after in.pdf [<range>] [-pad-with pad.pdf] -o out.pdf

cpdf -pad-every [<integer>] in.pdf [-pad-with pad.pdf] -o out.pdf

cpdf -pad-multiple [<integer>] in.pdf -o out.pdf

cpdf -pad-multiple-before [<integer>] in.pdf -o out.pdf

9.1 Two-up

This facility puts multiple logical pages on a single physical page. The -twoup-stack operation puts two logical pages on each physical page, rotating them 90 degrees to do so. The new mediabox is thus larger. The -twoup operation does the same, but scales the new sides down so that the media box is unchanged.

NB: See discussion of -fast in Section 1.13.

9.2 Inserting Blank Pages

Sometimes, for instance to get a printing arrangement right, it’s useful to be able to insert blank pages into a PDF file. cpdf can add blank pages before a given page or pages, or after. The pages in question are specified by a range in the usual way:

cpdf -pad-before in.pdf 1 -o out.pdf

Add a blank page before page 1 (i.e. at the beginning of the document.)

cpdf -pad-after in.pdf 2,16,38,84,121,147 -o out.pdf

Add a blank page after pages 2, 16, 38, 84, 121 and 147 (for instance, to add a clean page between chapters of a document.)

The dimensions of the padded page are derived from the boxes (media box, crop box etc.) of the page after or before which the padding is to be applied.

The -pad-every n operation places a blank page after every n pages, excluding any last one. For example…

cpdf -pad-every 3 in.pdf -o out.pdf

Add a blank page after every three pages

…on a 9 page document adds a blank page after pages 3 and 6.

In all three of these operations, one may specify -pad-with providing a (usually one-page) PDF file to be used instead of a blank page. For example, a page saying “This page left intentionally blank”.

The -pad-multiple n operation adds blank pages so the document has a multiple of n pages. For example:

cpdf -pad-multiple 8 in.pdf -o out.pdf

Add blank pages to in.pdf so it has a multiple of 8 pages.

The -pad-multiple-before n operation adds the padding pages at the beginning of the file instead.

Python Interface

# CHAPTER 9. Mulitpage facilities 
def twoUp(pdf): 
    """Impose a document two up by retaining the existing page 
    size, scaling pages down.""" 
def twoUpStack(pdf): 
    """Impose a document two up by doubling the page size, 
    to fit two pages on one.""" 
def padBefore(pdf, r): 
    """Adds a blank page before each page in the given range.""" 
def padAfter(pdf, r): 
    """Adds a blank page after each page in the given range.""" 
def padEvery(pdf, n): 
    """Adds a blank page after every n pages.""" 
def padMultiple(pdf, n): 
    """Adds pages at the end to pad the file to a multiple of n pages in 
def padMultipleBefore(pdf, n): 
    """Adds pages at the beginning to pad the file to a 
    multiple of n pages in length."""