ambevar-dotfiles/.scripts/pdfresize

23 lines
344 B
Bash
Executable File

#!/bin/sh
if [ $# -ne 2 ]; then
cat<<EOF
Usage: ${0##*/} INPUT OUTPUT
Resize input PDF to an A4 output PDF.
EOF
exit
fi
if [ ! -f "$1" ]; then
echo "$1 is not a valid file."
exit
fi
if [ -e "$2" ]; then
echo "$2 exists."
exit
fi
gs -q -o "$2" -sDEVICE=pdfwrite -sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage -dCompatibilityLevel=1.4 "$1"