ambevar-dotfiles/.scripts/pdfextract

14 lines
324 B
Bash
Executable File

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