print specific pages of a pdf from the command line?

Patton Echols p.echols at comcast.net
Sat May 29 04:40:56 UTC 2010


Doug Robinson wrote:
> Hello all
>     Is there any way to print, say 1 page of 5 of a pdf from the command 
> line?
>
>   

Have not tried this, but how about something like this:

First a test:
$ lpr testdoc.pdf

That should send the entire file to the default printer.  If that does 
not work, someone else needs to guide.  But Assuming it works, then I 
would try this:

$ pdftk your-document.pdf cat n-n output - | lpr

Notes:
1. You'll probably have to install pdftk, it is in the repos
2. "n-n" is any page ranges.  If you wanted to do page 2, pages 7 
through 11 and only the even numbered pages from 12 to the end of the 
document, you would replace "n-n" with "2 7-11 end-12even"
3. Syntax may not be exactly correct.  I have used pdftk quite a bit, 
but not for this and it has been a while.
4. The man page has examples that can be cooked together to do all sorts 
of stuff. 


Let us know how it goes!




More information about the ubuntu-users mailing list