Skip to content

Instantly share code, notes, and snippets.

@darribas
Created October 7, 2014 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save darribas/1317126af719045173b4 to your computer and use it in GitHub Desktop.
Save darribas/1317126af719045173b4 to your computer and use it in GitHub Desktop.
pdf2handout
#!/usr/bin/python
import os, sys
args = sys.argv
if len(args) > 1:
inpath = args[1]
if len(args)==2:
outpath = inpath.replace('.pdf', '_handout.pdf')
elif len(args)==3:
outpath = args[2]
cmd = ('pdfnup --nup 1x3 --frame true --paper a4paper --trim "0 0 0 0"' \
' --delta "1cm 1cm" --offset "0 0" --scale 0.91 --openright false --column' \
' false --columnstrict false --no-landscape --outfile %s %s')%(outpath,
inpath)
print cmd
os.system(cmd)
else:
print '''
###################
### pdf2handout ###
###################
Create a handout version of your pdf slides, with 3 slides per sheet
Usage:
pdf2handout file.pdf
pdf2handout file.pdf out.pdf
If no second argument is passed, handout written to the same name +
`_handout`
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment