View Single Post
Old 01-27-2021, 09:59 AM   #1841
willus
Fuzzball, the purple cat
willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.
 
willus's Avatar
 
Posts: 1,303
Karma: 11087488
Join Date: Jun 2011
Location: California
Device: iPad
Are you running linux or windows? FYI, with k2pdfopt, you can use %s for the filename minus the extension with the -o option, e.g.

k2pdfopt -grid 1x2x0 -mode crop booklet.pdf -o %s_split.pdf

The output will be booklet_split.pdf. I don't think qpdf has a similar option.
But you really don't need the intermediate files (split.pdf, booklet1.pdf, booklet2.pdf), do you? You just need the final file. You can delete the intermediate files after the final qpdf command. If you don't need the intermediate files, then this Windows batch command should work if you pass it the name of the pdf file without the pdf extension:

Code:
k2pdfopt -grid 1x2x0 -mode crop %1.pdf -o split.pdf
k2pdfopt -p 2-e split.pdf -mode copy -n -o booklet1.pdf
k2pdfopt -p 999-1o split.pdf -mode copy -n -rt 180 -o booklet2.pdf
qpdf --pages booklet1.pdf booklet2.pdf -- --empty %1_final.pdf
del /q split.pdf booklet1.pdf booklet2.pdf
E.g. if you call that file convert.bat, and want to convert booklet.pdf to booklet_final.pdf, then you would run:

convert booklet

The same works in Linux, but replace the %1 with a $1 and the "del /q" with "rm -f"

Thank you for the well wishes. Stay safe.
willus is offline   Reply With Quote