- From: Patel, Viral <viral.patel@countryfinancial.com>
- Date: Fri, 12 Mar 2004 08:23:14 -0600
- To: "'www-xsl-fo@w3.org'" <www-xsl-fo@w3.org>
> Hello, > > I have been using Apache FOP for few weeks now and I have successfully > implemented and embedded FOP that will convert XML to XSL-FO to PDF. I am > using the code that is listed below. > > My question is: I can only transform 1 XML to 1 PDF with the current > setup. I want the capability where multiple XML could be selected and all > of them would be combined and transformed to 1 PDF. I tried messing > around with this for few days. I also tried re-setting the driver and > then re-using it and appending the rest of the XML files to that 1 PDF but > it didnt work either. > > Is there any functionality built-in FOP that would allow this or any > work-arounds? > > I would appreciate any/all help. > > Thanks, > > Here is the code I have that works for 1 XML file to 1 PDF transformation: > > public static void main(String args[]) { > > try{ > File xmlfile = new File("D:/test.xml"); > File xslfile = new File("D:/test.xsl"); > > > File pdffile = new File("D:/test.pdf"); > > Driver driver = new Driver(); > driver.setRenderer(Driver.RENDER_PDF); > > driver.setOutputStream(new > java.io.FileOutputStream(pdffile)); > Result res = new > SAXResult(driver.getContentHandler()); > > Source src = new StreamSource(xmlfile); > > Source xsltSrc = new StreamSource(xslfile); > TransformerFactory transformerFactory = > TransformerFactory.newInstance(); > Transformer transformer = > transformerFactory.newTransformer(xsltSrc); > > transformer.transform(src, res); > System.out.println("--------- File completed."); > driver.reset(); > > } > catch(Exception e){ > System.out.println("Error in Main method: "+e); > } > } > > Viral Patel > Web Development > COUNTRY Insurance & Financial Services > http://www.countryfinancial.com/ > > Tel: 309.821.6605 > Fax: 309.820.4637 > mailto:viral.patel@countryfinancial.com > >
Received on Friday, 12 March 2004 09:24:52 UTC