Created
April 10, 2015 10:39
-
-
Save mat813/9c455be39622c1f9b138 to your computer and use it in GitHub Desktop.
Use pdftk to shuffle even and reverse odd scanned pages in a single document
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ `expr $# % 2` -ne 0 ] | |
then | |
echo "odd number of arguments" | |
exit 1 | |
fi | |
while [ $# -gt 0 ] | |
do | |
even=$1 | |
odd=$2 | |
shift 2 | |
echo shuffling ${even} and ${odd} | |
pdftk A="${even}" B="${odd}" shuffle A Bend-1 output ${even%.pdf}-${odd} | |
mkdir -p "#recycle" | |
mv "${even}" "${odd}" "#recycle"/ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment