Hi, I've been using FOP for a few days and i have a problem with displaying PDF through a browser with FOP. I'm using FOP 0.20.1 with Xalan 1.2 and Xerces 1.2. Here's a sample of my servlet source :
String xmlString = request.getParameter("XML"); String xslString = resquest.getParameter("XSL"); ByteArrayOutputStream fo = new ByteArrayOutputStream(); //XSLT transformation XSLTProcessor lProcessor = XSLTProcessorFactory.getProcessor(); lProcessor.process(new XSLTInputSource(new StringReader(xmlString)), new XSLTInputSource(new StringReader(xslString), new XLSTResultTarget(fo)); // PDF generation with FOP Driver lFOPDriver = new Driver(); InputSource FOSource = new InputSource(fo); response.setContentType("application/pdf"); ServletOutputStream output = response.getOutputStream(); lFOPDriver.setOutputStream(output); lFOPDriver.setRenderer(RENDER_PDF); XMLReader reader = (XMLReader) Class.forName("org.apache.xerces.parsers.SAXParser").newInstance(); lFOPDriver.setXmlReader(reader); lFOPDriver.setInputSource(FOSource); lFOPDriver.run(); output.flush(); output.close(); When I call this servlet, the browser don't display the generated PDF but I 've noticed that it appears in my Temporary Internet Files. Does anyone have an idea ? Regards. JD. ____________________________________________________________ Faites un voeu et puis Voila ! www.voila.fr Avec Voila Mail, consultez vos e-mails sur votre mobile Wap.