Using psnup to get two pages per page

psnup -2 file.ps | lpr

0
By: mnikhil
2009-02-07 18:48:18

These Might Interest You

  • Useful if you don't have at hand the ability to automatically create a booklet, but still want to. F is the number of pages to print. It *must* be a multiple of 4; append extra blank pages if needed. In evince, these are the steps to print it, adapted from https://help.gnome.org/users/evince/stable/duplex-npage.html.en : 1) Click File ▸ Print. 2) Choose the General tab. Under Range, choose Pages. Type the numbers of the pages in this order (this is what this one-liner does for you): n, 1, 2, n-1, n-2, 3, 4, n-3, n-4, 5, 6, n-5, n-6, 7, 8, n-7, n-8, 9, 10, n-9, n-10, 11, 12, n-11... ...until you have typed n-number of pages. 3) Choose the Page Setup tab. - Assuming a duplex printer: Under Layout, in the Two-side menu, select Short Edge (Flip). - If you can only print on one side, you have to print twice, one for the odd pages and one for the even pages. In the Pages per side option, select 2. In the Page ordering menu, select Left to right. 4) Click Print. Show Sample Output


    1
    F=136; [[ $(($F % 4)) == 0 ]] && for i in $(seq 1 $(($F/4))); do echo -n $(($F-2*($i-1))),$((2*$i-1)),$((2*$i)),$(($F-2*$i+1)),; done | sed 's/,$/\n/' || echo "Make F a multiple of 4."
    Kayvlim · 2014-06-11 01:21:08 0

  • 0
    psnup -4 -pa4 -Pa4 file.ps file2.ps
    mnikhil · 2009-02-07 18:47:53 0
  • This sums up the page count of multiple pdf files without the useless use of grep and sed which other commandlinefus use. Show Sample Output


    0
    find -iname "*.pdf" -exec pdfinfo -meta {} \;|awk '{if($1=="Pages:"){s+=$2}}END{print s}'
    Barabbas · 2011-12-13 15:02:11 0
  • Great idea camocrazed. Another twist would be to display a different man page based on the day of the year. The following will continuously cycle through all man pages: man $(ls /bin | sed -n $(($(date +%j) % $(ls /bin | wc -l)))p)


    -2
    man $(ls /bin | sed -n $((RANDOM % $(ls /bin | wc -l) + 1))p)
    putnamhill · 2010-08-20 17:15:33 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: