#!/bin/sh
#
#NAME
#  html2pdf - convert HTML to PDF
#
#SYNOPSIS
#  html2pdf basename
#  html2pdf infile outfile
#
#DESCRIPTION
#  This is a wrapper for the rather complicated htmldoc command  that
#  converts HTML to PDF.  It can be called in two forms:
#
#  One  command-line  arg should be the input/output pathname without
#  its suffix.  We will append ".html" for the source name and ".pdf"
#  for the target name.
#
#  Two  command-line  args  should be the input and output pathnames.
#  This is needed if you want the output  in  a  different  directory
#  than  the  input,  or  you  want  suffixes  other than ".html" and
#  ".pdf".
#
#BUGS
#  The path to htmldoc is hard coded.
#
#AUTHOR
#  John Chambers <jc@trillian.mit.edu>

if [ $# -eq 1 ]
then /usr/bin/htmldoc \
		--quiet --no-title \
		--path /home/jc/public_html \
		--header '   ' --footer ' / ' \
		--webpage -f $1.pdf $1.html
	exit
fi

if [ $# -eq 2 ]
then /usr/bin/htmldoc \
		--quiet --no-title \
		--path /home/jc/public_html \
		--header '   ' --footer ' / ' \
		--webpage -f $2 $1
	exit
fi

echo "Usage: $0 infile outfile"
echo "   or: $0 basename" 
exit 1
