- From: Marc <marc.liste@free.fr>
- Date: Mon, 29 Mar 2004 13:06:33 +0200
- To: "'www-xsl-fo@w3.org'" <www-xsl-fo@w3.org>
Viral, I think that the best way would be to merge the file at the beginning of the process, I dont' use JSP but my idea would be to write a file with all the file checked, and after that to use XSLT and XSL-FO to convert to a PDF. To do that you can use the document() function associate with the import stylesheet and the mode attribute of the template. Marc On Fri, 12 Mar 2004 08:23:14 -0600, you wrote: > > > >> 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 Monday, 29 March 2004 06:07:40 UTC