--- /dev/null
+#!/bin/bash
+
+print_usage()
+{
+ echo "$(basename $0) -- PDF rotate."
+ echo "Usage: $(basename $0) [OPTIONS...] INPUT-FILE"
+ echo "Options:"
+ echo " -h display this help and exit"
+}
+
+if [ "x${1}" = "x--help" ]; then
+ print_usage
+ exit 1
+fi
+
+if [ ${#} -ne 1 ]; then
+ echo "Missing input filename"
+ print_usage
+ exit 1
+fi
+
+src="${1}"
+
+temp=$(mktemp)
+
+gs -sDEVICE=pdfwrite -sOutputFile=${temp} -dNOPAUSE -dBATCH -dEPSCrop \
+ -c "<</Orientation 2>> setpagedevice" -f ${src}
+
+if [ ${?} -eq 0 ]; then
+ mv ${temp} ${src}
+else
+ rm${temp}
+fi