2013-03-03 11:19:50 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ $# -ne 4 ]; then
|
2014-11-12 16:15:39 +01: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
|
2013-03-03 11:19:50 +01:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$1" ]; then
|
2013-06-25 22:56:10 +02:00
|
|
|
echo "$1 is not a valid file."
|
2013-03-03 11:19:50 +01:00
|
|
|
fi
|
|
|
|
|
2016-06-23 23:18:36 +02:00
|
|
|
gs -sDEVICE=pdfwrite -dNOPAUSE -dSAFER -dSAFER -dFirstPage="$2" -dBATCH -dLastPage="$3" -sOutputFile="$4" "$1"
|