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