import java.io.*; import org.apache.fop.apps.*; import org.cn.reports.app.*; import org.xml.sax.*; public class Main { public static void main(String[] args) { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); java.sql.Connection con = java.sql.DriverManager.getConnection("jdbc:odbc:northwind", "admin", ""); ReportDriver reportDriver = new ReportDriver(new FileInputStream("test.xml"), out); reportDriver.setConnection(con); reportDriver.setParams(new String[] { "date-start"}, new String[] { "05/24/04"}); reportDriver.setParams(new String[] { "date-end"}, new String[] { "05/24/04"}); reportDriver.run(); FileOutputStream fout = new FileOutputStream(new File("test.pdf")); Driver driver = new Driver(new InputSource(new ByteArrayInputStream(out.toByteArray())), fout); driver.setRenderer(Driver.RENDER_PDF); driver.run(); System.out.println("Report created"); } catch(FileNotFoundException fileNotFoundException){ fileNotFoundException.printStackTrace(); } catch (Throwable t) { t.printStackTrace(); } } }