Skip to content

Instantly share code, notes, and snippets.

@hawx
Created January 5, 2013 17:59
Show Gist options
  • Save hawx/4462794 to your computer and use it in GitHub Desktop.
Save hawx/4462794 to your computer and use it in GitHub Desktop.
Takes a pdf, splits pages in half horizontally, rotates them, then glues them together into a pdf.
# Usage: sh splitconv.sh "some.pdf"
echo "Making temporary directory..."
mkdir "splitconv-tmp"
echo "Splitting pdf..."
convert -size 1x2@ "$1" "splitconv-tmp/split.png"
echo "Rotating pages..."
convert -rotate 270 "tmp-tmp-tmp/split-*.png" "splitconv-tmp/rot.png"
echo "Creating done.pdf..."
convert -page a5 "tmp-tmp-tmp/rot-*.png" done.pdf
rm -rf "splitconv-tmp"
echo "Finished."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment