ambevar-dotfiles/.scripts/pdfextract

17 lines
316 B
Plaintext
Raw Normal View History

#!/bin/sh
if [ $# -ne 4 ]; then
2013-06-25 22:56:10 +02:00
cat<<EOF
2013-08-13 18:23:30 +02:00
Usage: ${0##*/} PDFFILE FIRSTPAGE LASTPAGE DESTFILE
2013-06-25 22:56:10 +02:00
Extract a range of pages from a PDF.
EOF
exit
fi
if [ ! -f "$1" ]; then
2013-06-25 22:56:10 +02:00
echo "$1 is not a valid file."
fi
gs -sDEVICE=pdfwrite -dNOPAUSE -dSAFER -dSAFER -dFirstPage=$2 -dBATCH -dLastPage=$3 -sOutputFile="$4" "$1"