Skip to content

Instantly share code, notes, and snippets.

@karthikraman karthikraman/pdfpextr.sh
Last active Aug 29, 2015

Embed
What would you like to do?
Bash: PDF page extractor
#Courtesy: http://www.linuxjournal.com/content/tech-tip-extract-pages-pdf
#Add this to your .bashrc
function pdfpextr()
{
# 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
# output file will be named "inputfile_pXX-pYY.pdf"
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
-dFirstPage=${2} \
-dLastPage=${3} \
-sOutputFile=${1%.pdf}_p${2}-p${3}.pdf \
${1}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.