How can you print pages from 7 to 17 by lpr?
Asked
Active
Viewed 1.7k times
3 Answers
22
lpr -P myprinter -o page-ranges=7-17
where myprinter is the name of your printer
Sathyajith Bhat
- 61,504
- 38
- 179
- 264
-
2How did you find the information about the flag: `- page-ranges=7-17 `.? It is not in my manual in Ubuntu. – Léo Léopold Hertz 준영 Dec 02 '09 at 20:03
-
1I just Googled for "lpr page range" - and lo - first result – Sathyajith Bhat Dec 02 '09 at 21:42
-
1i think the command should be `-o page-ranges=7-17` not `- page-ranges=7-17`. can't test since i have no printer, but you don't give your source so i can't look to see if the typo is yours or theirs. – quack quixote Dec 02 '09 at 23:11
-
1@~quack That's correct. Not sure how I missed typing the missing letter. – Sathyajith Bhat Dec 03 '09 at 09:22
-
1Depending on how you installed lpr, -o may or may not work! See here: http://superuser.com/questions/230379/adobe-reader-seems-to-use-wrong-lpr-command-when-printing-to-cups and here: http://superuser.com/questions/371577/how-do-i-tell-aptitude-or-apt-to-offer-a-particular-version-of-lpr – zebonaut Dec 29 '11 at 22:35
-
2@Masi Standard options are described [in CUPS online documentation](https://www.cups.org/documentation.php/options.html#OPTIONS). And from the same page : "*Printer-specific options are also available and can be listed using the lpoptions command: `lpoptions -p printer -l`*". – Skippy le Grand Gourou May 12 '16 at 10:26
3
Masi, the command IS documented on your Ubuntu box, in the online-help for CUPS. Visit
http://localhost:631/help/options.html?TOPIC=Getting+Started&QUERY=#PAGERANGES
to see what I mean.
Kurt Pfeifle
- 12,411
- 2
- 54
- 71
-
For some reason, the page-ranges options is not listed in the `man` page, though… – Socob Mar 11 '22 at 15:18
1
man lp has the -P option for page range:
-P page-list
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". 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.
Here is a full command I use often:
lp -P 5-22 -o media=A4 -o number-up=2 -o sides=two-sided-long-edge -o fit-to-page R-ints.pdf
isomorphismes
- 1,864
- 2
- 20
- 31