Skip to content

Instantly share code, notes, and snippets.

@AndreasBaumgart
Created December 20, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreasBaumgart/37f6a4b8107e71109948 to your computer and use it in GitHub Desktop.
Save AndreasBaumgart/37f6a4b8107e71109948 to your computer and use it in GitHub Desktop.
#!/bin/bash
for i in {0..28};
do
firstPageNumber=$(expr \( $i \* 16 \) + 1)
lastPageNumber=$(expr $firstPageNumber + 15)
dest="$(printf "%04d\n" $firstPageNumber)-$(printf "%04d\n" $lastPageNumber).pdf"
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
-dFirstPage=$firstPageNumber \
-dLastPage=$lastPageNumber \
-sOutputFile=$dest \
orig.pdf
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment