I changed the code as mentioned
FopFactory fopFactory = FopFactory.newInstance(); FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); OutputStream out = new BufferedOutputStream(new FileOutputStream(new File(("\bro.pdf")))); try { Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); TransformerFactory factory = new org.apache.xalan.processor.TransformerFactoryImpl(); Transformer transformer = factory.newTransformer(new StreamSource(new File("\Brodart.xsl"))); transformer.setParameter("versionParam", "2.0"); Source src = new DOMSource(doc); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); Even then it is taking long time. Please HELP Manoj Jeremias Maerki-2 wrote: > > Manuel already gave you some tips in > http://issues.apache.org/bugzilla/show_bug.cgi?id=42590 > > The example files you attached don't even take 2 seconds from the > command-line and that's including VM startup and class-loading. So the > problem is probably somewhere else (maybe the machine is swapping like > mad or the app server has not enough memory available and is constantly > in garbage collection). I also don't see anything wrong with your code > except that you set a system property within an application server which > is bad practice. Instead of: > > System.setProperty("javax.xml.transform.TransformerFactory","org.apache.xalan.processor.TransformerFactoryImpl"); > TransformerFactory factory = TransformerFactory.newInstance(); > > I'd write: > > TransformerFactory factory = new > org.apache.xalan.processor.TransformerFactoryImpl(); > > ...if you want to control which XSLT implementation you want to use. > Setting the system property affects the whole application server! > > On 06.06.2007 16:36:46 manojkmi wrote: >> >> Hi, >> >> I created a code snippet to convert XML+XSL FO to PDF using FOP. >> I am using OC4j as Application Server. >> >> Here is the code: >> >> FopFactory fopFactory = FopFactory.newInstance(); >> FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); >> OutputStream out = new BufferedOutputStream(new >> FileOutputStream(new >> file("/brodart.pdf"))); >> Try >> { >> >> System.setProperty("javax.xml.transform.TransformerFactory","org.apache.xalan.processor.TransformerFactoryImpl"); >> Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, >> out); >> TransformerFactory factory = TransformerFactory.newInstance(); >> Transformer transformer = factory.newTransformer(new >> StreamSource(new File("/Brodart.xsl"))); >> transformer.setParameter("versionParam", "2.0"); >> Source src = new StreamSource(new File("/brodart.xml")); >> Result res = new SAXResult(fop.getDefaultHandler()); >> transformer.transform(src, res); >> } >> >> >> >> At the highlighted step seems to be taking a lot of time to execute >> (around >> 15 min). >> >> Can any one please help on this issue? Here I attached the XML and XSL >> file >> we are using. >> >> >> Thanks >> Manoj http://www.nabble.com/file/p10989960/XML_XSL.zip XML_XSL.zip >> -- >> View this message in context: >> http://www.nabble.com/Perfomance-Issue-need-Help-on-generating-PDF-from-XSL-FO-tf3878334.html#a10989960 >> Sent from the FOP - Users mailing list archive at Nabble.com. > > > > Jeremias Maerki > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Perfomance-Issue-need-Help-on-generating-PDF-from-XSL-FO-tf3878334.html#a11586692 Sent from the FOP - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]