public static void main(String[] args) {
int code = 0;
if (args.length > 1)
{
try
{
XmlToPdf x;
if (args.length > 2)
{
x = new XmlToPdf(args[2]);
}//end if at least 3 args
else
{
x = new XmlToPdf();
}//end else, only 2 args
x.parse(new FileInputStream(args[0]), new FileOutputStream(args[1]));
}//end try to do everything
catch (Exception ex)
{
code = 2;
ex.printStackTrace(System.err);
}//end catch Exception
}//end if at least 2 args
else
{
code = 1;
System.err.println(
"Usage: XmlToPdf [XML file in] [PDF file out] [optional page size]");
}//end else, not enough arguments
System.exit(code);
}
Main method of the XmlToPdf class. |