[Novalug] concatenating pdf files
Jon LaBadie
novalugml@jgcomp.com
Thu Nov 6 02:14:27 EST 2008
On Wed, Nov 05, 2008 at 10:44:30PM -0500, Jon LaBadie wrote:
>
> You could allow command line args and request missing values.
> Here is an untested version.
>
When I read my own post I noticed a couple of extra quotes
and also realized I should have used printf instead of
echo for portability reasons.
Here is a minor revision correcting those oversights.
# check for too many args:
if [ $# -gt 3 ]
then
printf "$0: Too many arguments\n" >&2
printf "$0: Concatenates PDF files\n" >&2
printf "Usage: $0 [output_pdf_file] [input1] [input2]\n" >&2
exit 1
fi
Output="$1"
Input1="$2"
Input2="$3"
if [ "$Output" = "" ]
then
printf "Output File Name? "
read Output
fi
if [ "$Input1" = "" ]
then
printf "First Input File Name? "
read Input1
fi
if [ "$Input2" = "" ]
then
printf "Second Input File Name? "
read Input2
fi
# if any still missing, exit
if [ "$Output" = "" ] ||
[ "$Input1" = "" ] ||
[ "$Input2" = "" ]
then
printf "$0: 3 file names must be supplied!\n" >&2
exit 2
fi
# execute the gs cmd
/usr/bin/gs -dBATCH -dNOPAUSE -q \
-sDEVICE=pdfwrite \
-sOutputFile="$Output" \
"$Input1" "$Input2"
--
Jon H. LaBadie jon@jgcomp.com
JG Computing
12027 Creekbend Drive (703) 787-0884
Reston, VA 20194 (703) 787-0922 (fax)
More information about the Novalug
mailing list