Last active
August 29, 2015 14:22
-
-
Save karthikraman/80b96276ba8b85cbd4d4 to your computer and use it in GitHub Desktop.
Bash: PDF page extractor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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