Skip to content

Instantly share code, notes, and snippets.

@ragusa87
Created July 29, 2015 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ragusa87/1640c57792f2c14cf265 to your computer and use it in GitHub Desktop.
Save ragusa87/1640c57792f2c14cf265 to your computer and use it in GitHub Desktop.
Rotate pdf left with pdftk
#!/bin/sh
if [ "$#" -ne 1 ]; then
echo "Usage: $0 filename"
exit 1;
fi
if [ ! -f $1 ]; then
echo "File not found!"
exit 2
fi
mv $1 $1.tmp
pdftk $1.tmp cat 1-endleft output $1
if [ $? -eq 0 ]; then
rm $1.tmp
else
mv $1.tmp $1
echo "Error"
exit 3
fi
@ragusa87
Copy link
Author

if pdftk is not available, use qpdf instead:
qpdf --rotate=+180:1-z $1.tmp $1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment