#!/bin/sh # Select a range of pages from a PDF file. # Adam Sampson # Based on: http://www.linuxjournal.com/content/tech-tip-extract-pages-pdf first="$1" last="$2" input="$3" output="$4" if [ "$output" = "" ]; then echo "Usage: pdfselect FIRST LAST INPUT.pdf OUTPUT.pdf" exit 1 fi exec gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER \ -dFirstPage="$first" \ -dLastPage="$last" \ -sOutputFile="$output" \ "$input"