#!/bin/bash
#===============================================================================
#
#          FILE:  convertToPDF.sh
# 
#         USAGE:  ./convertToPDF.sh 
# 
#   DESCRIPTION:  Converts any file the OpenOffice can open to a PDF file
# 
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR:  John Ryland (jryland@xiaofrog.com)
#       COMPANY:  InvertedLogic
#       VERSION:  1.0
#       CREATED:  06/25/08 17:26:25 CST
#      REVISION:  ---
#===============================================================================
IN="$PWD/$1"
OUT="$PWD/$2"
if [ -f "$IN" ]
then
    if [ "$2" == "" ]
    then
        echo "Usage: $0 inputfile outputfile"
        exit -1
    fi
    if [ -f "$OUT" ]
    then
        echo "convertToPDF.sh aborting, destination file aready exists, delete first"
        exit -1
    fi
    echo "Converting \"$1\" to PDF"
    # /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.MyConversions.SaveAsPDF\("$1"\)
    /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible macro:///Standard.conversions.SaveAsPDF\("$IN","$OUT"\)
else
    echo "Usage: $0 inputfile outputfile"
    exit -1
fi

