Created
October 26, 2016 15:49
-
-
Save blizzz/8e3bc88c9a0dc2db40c79b0eaa4281ef to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
if [ $# -ne 2 ]; then | |
echo "split pdf to single pages" | |
echo "Usage:" | |
echo "$0 Inputfile Outputtrunk" | |
echo "Example:" | |
echo "\"$0 input.pdf out-\" results in out-1.pdf, out-2.pdf .. out-n.pdf" | |
exit | |
fi | |
ORIGINAL=$1 | |
OUTPUTTRUNK=$2 | |
PAGES=`qpdf --show-npages "$ORIGINAL"` | |
I=1 | |
while [ "$I" -le "$PAGES" ]; | |
do | |
qpdf "$ORIGINAL" --pages "$ORIGINAL" "$I"-"$I" -- "$OUTPUTTRUNK[$I].pdf" | |
let I=I+1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment