#! /bin/bash
cyflexlogevent -t generic -m 1 -m "script" -m "$0" 

#
# Script name: pdf_report arguments
#
# Purpose: Generate an updated PDF file based on a PDF XFDF file and
#    CyFlex label values.
#
# Invoking arguments:
#    -connection CONNECTION  Optional - CyFlex connection.
#                            Default - "local".
#    -pdf PDF                Input base PDF file
#    -xfdf XFDF              Input XFDF file associated with PDF
#    -object_name NAME       Name of object file references in XFDF
#    -output OUTPUT          Output PDF file generated.
#    -retain true            Optional - retain intermediate files
#                            Default - do not retain intermediate files
#
# Notes:
#
# History:
#   07/07/10 - Rob Janes - Initial release.
#

if (( $# == 0 )); then
cat <<eod

Usage: pdf_report -pdf Report.pdf -xfdf Report.xfdf -output NewReport.pdf -object_name cyflex
eod
exit 1
fi

. configure_java

# Shell variables must begin with a letter.  So this can not be called
# 3RDPARTY.  D is for Directory.
D3RDPARTY=$D3
SPECFILEGUI=$GUI
PROPERTIES="-DPropertiesFile=$CELL/cui_properties.txt"

PROPERTY_FILE=`echo $PROPERTIES | cut -f2 -d= `

# Jar files are listing in approximate order of their use.
CLASSPATH=\
$SPECFILEGUI/applications.jar\
:$SPECFILEGUI/specfilegui.jar\
:$SPECFILEGUI/facade.jar\
:$D3RDPARTY/velocity-1.6.1-dep.jar\
:$D3RDPARTY/iText-5.0.2.jar\
:$D3RDPARTY/protobuf.jar\
:$D3RDPARTY/jcmdline.jar
export CLASSPATH

chrt -o 0 java -Xms128m -Xmx1024m $PROPERTIES \
   com.cybermetrix.cyflex.applications.pdf_report $* &
