18 lines
333 B
Bash
Executable File
18 lines
333 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ $# -ne 4 ]; then
|
|
cat <<EOF>&2
|
|
Usage: ${0##*/} PDFFILE FIRSTPAGE LASTPAGE DESTFILE
|
|
|
|
Extract a range of pages from a PDF.
|
|
EOF
|
|
exit
|
|
fi
|
|
|
|
if [ ! -f "$1" ]; then
|
|
echo >&2 "$1 is not a valid file."
|
|
exit 1
|
|
fi
|
|
|
|
gs -sDEVICE=pdfwrite -dNOPAUSE -dSAFER -dSAFER -dFirstPage="$2" -dBATCH -dLastPage="$3" -sOutputFile="$4" "$1"
|