pdfsplit

This allows you to split a pdf from the copier into separate documents:

   1 #!/bin/bash
   2 #
   3 # pdfsplit [input.pdf] [original_page_count] [pages_per_document] [output_name]
   4 #
   5 # Example: pdfsplit input.pdf 48 4 output
   6 # Result: creates files output1.pdf, output2.pdf, ..., output12.pdf
   7 #
   8 
   9 if [ $# -lt 4 ]
  10 then
  11   echo "Usage: pdfsplit [input.pdf] [original_page_count] [pages_per_document] [output_name]"
  12   exit 1
  13 fi
  14 i=1
  15 fpage=1
  16 lpage=$3
  17 while [ $fpage -lt $2 ]; do
  18   gs -dBATCH -dNOPAUSE -sOutputFile="$4$fpage.pdf" -dFirstPage=$fpage -dLastPage=$lpage -sDEVICE=pdfwrite "$1" > /dev/null
  19   echo "wrote $4$fpage.pdf"
  20   fpage=$(($fpage + $3))
  21   lpage=$(($lpage + $3))
  22 done

Scripts/pdfsplit (last edited 2015-12-03 15:07:50 by scot)