1

I am trying to print particular set of pages using lp command, but page-ranges option is not getting me the exact pages.

lpr -o page-ranges=1,3,5,6,9 filename
1
  • You could try lp instead of lpr, lp -P 1,3,5,6,9 filename
    – meuh
    Aug 7, 2015 at 8:34

2 Answers 2

0

lp knows the option -P to set a page list

-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.

4
  • can u please give me one example, didn't understand this sentence "The page numbers refer to the output pages and not the document's original pages"
    – user479394
    Aug 7, 2015 at 10:16
  • I don't know lp that much, but it means, that if you switch the pages (that last page. comes first) the -P option affects the pages how they would come out of the printer, not how they are in the document Aug 7, 2015 at 10:19
  • Thanks for the info.. I want to print the pages how they are available in the document(PCL file).
    – user479394
    Aug 7, 2015 at 10:25
  • then I don't think you will have got any problems with the option.... Aug 7, 2015 at 10:29
0

There's a linux utility that will help you with this task called seq.

See:

echo $(seq -f "%g," 1 2 10) # prints all odd numbers from 1 to 10
lp -P $(seq -f "%g," 1 2 10) filename.pdf  # prints odd pages from 1 to 10 of filename.pdf

Read seq --help to learn more :D

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .