X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=scripts%2Fhvpdf-rotate;fp=scripts%2Fhvpdf-rotate;h=19e4bf6003da18d5a097634abeb2404915e892b2;hb=36216bb19e90ebdde5b3904c993a319a91d19ec3;hp=0000000000000000000000000000000000000000;hpb=3104f7d42a0424c764c1aa483bc0349ab3900e40;p=hvutilities.git diff --git a/scripts/hvpdf-rotate b/scripts/hvpdf-rotate new file mode 100755 index 0000000..19e4bf6 --- /dev/null +++ b/scripts/hvpdf-rotate @@ -0,0 +1,33 @@ +#!/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 "<> setpagedevice" -f ${src} + +if [ ${?} -eq 0 ]; then + mv ${temp} ${src} +else + rm${temp} +fi