Need to split a multipage PDF into individual files?

Ghostscript and bash to the rescue.  I found out ahead of time that there were 136 pages in my source.pdf.

for i in {1..136};  do echo $i; gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=$i -dLastPage=$i -sOutputFile=$i.pdf source.pdf ; done

Leave a Reply

Your email address will not be published. Required fields are marked *