You don’t need Acrobat for this. GhostScript does an excellent job. I’ve used this under Cygwin as well as my gentoo, but should work on any platform gs runs on. Here is a stab at a simple bash script:


#!/bin/bash

usage() {
        echo "$0 {first page} {last page} {input pdf file} {output pdf file}"
}

extract() {
  gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \
     -dFirstPage=$1 -dLastPage=$2 \
     -sOutputFile=$4 $3
}


EXPECTED_ARGS=4
E_BADARGS=65

if [ $# -ne $EXPECTED_ARGS ]
then
  usage
  exit $E_BADARGS
else
  extract $1 $2 $3 $4
fi

2+