Thanks for the suggestions
in the end I found a blog by Sandeep Sidhu where he had a similar problem of extracting individual pages from a pdf in his solution he created a function in bashrc to shorten the command.
Code:
function pdf-extract()
{
# 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=${1} \
-dLastPage=${2} \
-sOutputFile=${3%.pdf}_page${1}_to_page${2}.pdf \
${3}
}
@anglican thanks for pointing out that ghostscript can output to image so I combined your suggestion with Sandeep's function and I get this
Code:
function pdf-extract()
{
# 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=jpeg -dNOPAUSE -dBATCH -dSAFER -dJPEGQ=100 \
-dFirstPage=${1} \
-dLastPage=${2} \
-sOutputFile=doc-%02d.jpg \
${3}
}
after adding this to bashrc the command to produce images is this
Code:
pdf-extract 2 5 *.pdf
Sweet
Bookmarks