ambevar-dotfiles/.scripts/pdfextract

17 lines
317 B
Plaintext
Raw Normal View History

#!/bin/sh
if [ $# -ne 4 ]; then
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
2016-06-23 23:18:36 +02:00
gs -sDEVICE=pdfwrite -dNOPAUSE -dSAFER -dSAFER -dFirstPage="$2" -dBATCH -dLastPage="$3" -sOutputFile="$4" "$1"