summaryrefslogtreecommitdiff
path: root/support/m-tx/doc/pdfcat
blob: fd773f76903cb4c66ecdc8e3e727e9f150aa4f07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

# pdfcat.sh
# Thanks to Christian Mondrup for this script

FILENAME=`basename $0`

USAGE="Usage: $FILENAME [-a (A4 paper)] -o outputfile -i \"inputfile1 inputfile12 ...\""

if [ $# -le 3 ]
then
    echo $USAGE
    exit 2
fi 

GSARGS="-q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite"

while getopts "i:o:a" ARG_STRING
do
    case $ARG_STRING in
    a)	GSARGS="-sPAPERSIZE=a4 $GSARGS"
        ;;
    i)  INPUTFILES=$OPTARG
	;;
    o)	OUTPUTNAME=$OPTARG
	;;
    *)	echo $USAGE
	exit 2;;
    esac
done

gs $GSARGS -sOutputFile=$OUTPUTNAME $INPUTFILES