#!/bin/sh

# psrun -- make a batch file for distiller and run it

# usage: psrun 
# Required input file: BOOKFILE
# Sorry for the rigid UI, but file must be read by this script AND by awk

set -x

rm -f book.pdf book.ps book.log

nawk -f psrun.awk `nawk '{print $1}' BOOKFILES` 	# writes to book.ps

distill book.ps

sed '/^\/Type \/Catalog/a\
/PageMode /UseOutlines' book.pdf > j.pdf

echo "Save it as book.pdf"

acroexch j.pdf

rm -i j.pdf
