Splitting pdf documents into seperate pages
Posted: Mon Oct 03, 2005 4:24 pm
Today I needed to split up another pdf catalog for the web. I found that ghost script can do quite nicely so I wrote this quick script to create the individual pages and thumbnails.
for count in `seq $2`
do
echo Creating PDF $count.pdf
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dFirstPage=$count -dLastPage=$count -sOutputFile=$count.pdf $1
echo Creating jpeg thumbnail $count.jpg
convert -resize 100x100 $count.pdf $count.jpg
done
for count in `seq $2`
do
echo Creating PDF $count.pdf
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dFirstPage=$count -dLastPage=$count -sOutputFile=$count.pdf $1
echo Creating jpeg thumbnail $count.jpg
convert -resize 100x100 $count.pdf $count.jpg
done