#!/usr/bin/python3 #coding=utf8 import pdftools, sys, shlex cmdstr = '-i \"' + sys.argv[ 1] + '\" --out-suffix _nup21 --nup 2 1 --frame --width 0.87 --delta 0cm 0cm --paginate --overwrite --text \"$filename\" 0.4 0.005' cmdstr_splitted = shlex.split(cmdstr) #print(cmdstr_splitted) pdftools.main(cmdstr_splitted)
#!/usr/bin/python3 #coding=utf8 import pdftools, sys cmdstr = ( "-i " + sys.argv[1] + " --out-suffix _1page --split-pages --trim 0 0 0.5\\pdfwidth 0 --overwrite" ).split() pdftools.main(cmdstr)
#!/usr/bin/python3 #coding=utf8 import pdftools, sys, shlex from os import path white_path = path.splitext(sys.argv[1])[0]+"_W.pdf" print(white_path) cmdstr1 = "-i \""+sys.argv[1]+"\" --out-suffix _W --white-page --fitpaper --overwrite" cmdstr2 = "-i \""+white_path+"\" --out-suffix _HANDOUT --nup 3 2 --frame --overwrite --paginate --delta 0mm 5mm --width 0.45" cmdstr1_splitted = shlex.split(cmdstr1) cmdstr2_splitted = shlex.split(cmdstr2) pdftools.main(cmdstr1_splitted) pdftools.main(cmdstr2_splitted)