32 lines
736 B
Bash
Executable File
32 lines
736 B
Bash
Executable File
#!/bin/bash
|
|
if [ "$1" == "-h" ] ; then
|
|
echo "
|
|
pdfsplit - extract a range of pdf pages with ghostscript
|
|
|
|
usage:
|
|
pdfsplit firstPage lastPage inputFile.pdf
|
|
|
|
output file will be named inputfile_pXX-pYY.pdf
|
|
|
|
depends:
|
|
gs - ghostscript
|
|
|
|
"
|
|
exit 0
|
|
fi
|
|
|
|
# the following is from a stackoverflow answer
|
|
# function pdfsplit()
|
|
# {
|
|
# this function uses 3 arguments:
|
|
# $1 is the first page of the range to extract
|
|
# $2 is the last page of the range to extract
|
|
# $3 is the input file
|
|
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
|
|
-dFirstPage=${1} \
|
|
-dLastPage=${2} \
|
|
-sOutputFile=${3%.pdf}_p${1}-p${2}.pdf \
|
|
${3}
|
|
# }
|
|
|