Jérôme Belleman
Home  •  Tools  •  Posts  •  Talks  •  Travels  •  Graphics  •  About Me

Number-Up Printing with CUPS

16 Apr 2006

The art of printing several pages on a single sheet of paper, and to do so getting it right the first time rather than spending pages working it out.

1 On the Command-Line

The lp command comes with the -o number-up option which expects numeric values for different configuration – 2, 4, 6, 9 or 16 input pages per output page:

lp -o number-up=4 foo

As you can expect, there's a fair number of ways the input pages can be arranged and most of them will not be what you want. In particular, there's the page list option which I found rather treacherous before I read the man page.

2 The Treacherous Page List

When it comes to specifying a page list with the lp -P option, you need to think of it in terms of output pages printed rather than input pages to be printed. So in other words, it's best to consider actual, physical pages, as opposed to electronic pages. For instance, when printing 2-up, printing the 1,2 page list will effectively result in printing electronic pages 1,2,3,4.

Worse than unpredictable, it keeps you from printing out specific input page lists. For instance, printing 2-up, lp will not let you print input pages 1 and 3 on the same page. You would have to specify -P 1,2 to get them and pages 2 and 4 will also be printed out in the process.

3 Page Ordering

It's not something I saw advertised in my man page, but lp also offers the number-up-layout option taking values looking like the default lrtb for left to right, top to bottom and all other possible combinations.

Page Ordering When Number-Up Printing
Page Ordering When Number-Up Printing

When using the number-up option, your input pages will be laid out accordingly in an output page in landscape orientation. And you can't seem to be able to convince lp to do so otherwise even when you pass it the rather obscure -o orientation-requested option.

4 Getting It Right and Cheating

So far then, the number-up option as provided by lp doesn't appear to be the most convenient to use. Certainly, you don't have to spend paper to make a few attempts. The CUPS-PDF virtual printer is a good way to experiment with lp options by printing out PDF files and getting it to work is as easy as installing a package called something like printer-driver-cups-pdf.

A more convoluted alternative but extremely safe and flexible approach is to leave it all to LATEX provided it's a typesetter you're comfortable with. I like to think everybody should be. In essence: the \includegraphics command from the graphicx package setting the width option, a \forloop from the forloop package for processing large PDF documents and possibly Tikz for ultimate control in positioning. I go at great lengths on this when describing ways to editing PDFs with LATEX.

5 References