lp: page selection with -P processed after number-up #3008

michaelrsweet opened this Issue Nov 16, 2008 · 7 comments


None yet
2 participants

michaelrsweet commented Nov 16, 2008

Version: 1.3.9
CUPS.org User: martin.pitt.canonical

From http://bugs.debian.org/501311:

------ snip -------
lp -P 41-51 -o number-up=2 file.pdf

I expected it to extract pp. 41-51 from file.pdf, then convert them to
2up and send it to the printer.

I can think of two fixes:

  1. In the description of the -P switch in the 'lp' manpage, explain
    that the page numbers are those after page rearrangements.
  2. Change the cups filters to first select pages with -P, then
    rearrange pages.

The first fix clarifies the situation but makes it hard to use -P
with number-up, so I like the second fix.
------ snip -------

I confirmed the issue with 1.3.9.


michaelrsweet commented Nov 16, 2008

CUPS.org User: mike

IPP specifies the page-ranges applies after imposition, so the current implementation is correct.

I'll add a note to the documentation about the behavior.


michaelrsweet commented Nov 17, 2008

CUPS.org User: mike

Fixed in Subversion repository.


michaelrsweet commented Nov 17, 2008


Index: doc/help/options.html

--- doc/help/options.html (revision 8133)
+++ doc/help/options.html (working copy)
@@ -440,6 +440,15 @@

The default is to print all pages.



The page numbers used by page-ranges refer to the output
+pages and not the document's page numbers. Options like number-up
+can make the output page numbering not match the document page numbers.



Selecting Even or Odd Pages

Use the -o page-set=set option to select the even or odd pages:

Index: man/lp.man

--- man/lp.man (revision 8133)
+++ man/lp.man (working copy)
@@ -12,7 +12,7 @@
." which should have been included with this file. If this file is
." file is missing or damaged, see the license at "http://www.cups.org/".
-.TH lp 1 "Common UNIX Printing System" "29 August 2008" "Apple Inc."
+.TH lp 1 "Common UNIX Printing System" "17 November 2008" "Apple Inc."
lp - print files
@@ -154,7 +154,10 @@
Specifies which pages to print in the document. The list can
contain a list of numbers and ranges (#-#) separated by commas
-(e.g. 1,3-5,16).
+(e.g. 1,3-5,16). The page numbers refer to the output pages and
+not the document's original pages - options like "number-up" can
+affect the numbering of the pages.
+that are
Aside from the printer-specific options reported by the
\fIlpoptions(1)\fR command, the following generic options are
@@ -186,6 +189,18 @@
Scales the print file to fit on the page.
.TP 5
+-o number-up=2
+.TP 5
+-o number-up=4
+.TP 5
+-o number-up=6
+.TP 5
+-o number-up=9
+.TP 5
+-o number-up=16
+Prints multiple document pages on each output page.
+.TP 5
-o scaling=number
Scales image files to use up to \fInumber\fR percent of the page.

@michaelrsweet michaelrsweet added this to the Stable milestone Mar 17, 2016

@michaelrsweet said "IPP specifies the page-ranges applies after imposition, so the current implementation is correct."...

Where does IPP specify that page-ranges applies after number-up processing? I'm looking at


and don't see it...

Anyway, this is super counter-intuitive. If it is really what the spec says, then it would be nice to also have an option like input-page-ranges which would allow users to select pages from the actual document.


michaelrsweet commented May 26, 2016

You want to look at RFC 2911 - RFC 2566 (IPP/1.0) is OBSOLETE and experimental.

Thank you. Now, I'm looking at this:


I don't see what you were referring to (back in 2008!).

In fact, section 15.3 says this:

  2. The document data is in the form of a print-stream in a known
     media type. The "page-ranges" attribute is used to select, as
     specified in section 4.2.7, a sub-sequence of the pages in the
     print-stream that are to be processed and images.

  3. The input to this step is a sequence of print-stream pages.
     This step is controlled by the "number-up" attribute. If the
     value of "number-up" is N, then during the processing of the
     print-stream pages, each N print-stream pages are positioned,
     as specified in section 4.2.9, to create a single impression.

I think the words "the input to this step" mean "the input to step 3", since steps are being numbered. I guess step 3 could be described as taking pages and turning them into "impressions". Impressions are sent to the printer and put on pages, but a single impression might contain multiple document pages. The way I read this, applying the "page-ranges" option (in step 2) takes the user-supplied range arguments and uses them to select numbered document pages (from the formatting step, step 1) not impressions (from step 3)...

@michaelrsweet - I didn't mean to scare you away with my interpretation of RFC 2911. I was just trying to help us both figure out where you were coming from... Were we looking at different documents? Different parts of the same document? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment