Hans-Jürgen Wiesner wrote: > Hello all, > I'm new to FOP and are charged with embedding it in a Servlet > application. We need to send a JSP as HTML or PDF, depending on the > user. So we made a JSP which outputs valid XHTML and tried to convert > that via FO into PDF. > After much experimentation, I succeeded in installing a filter > intercepting the JSP-Servlets output to convert it by calling FOP. > The conversion works on the command line; however, I have great problems > embedding FOP in my filter.
It is usually not a good idea to use JSP to generate XML for further processing. Well, you can use a SAX event stream to overcome the unfortunate design of the XSLTInputHandler, look here: http://marc.theaimsgroup.com/?l=fop-user&m=101735493205659&w=2 This way you can supply an arbitrary XML source to your transformer. For generating the data, i suggest to look into writing your own SAX source. The basics are much easier than many people think: implement the javax.xml.parser.XMLReader interface, and if necessary provide your own implementation of an InputSource to provide run time parametrization. > The next problem is that FOP doesn't convert when called from my filter. > I get an exception from driver.render(); the logger tells me: > > INFO 10191 [fop ] (): building formatting object tree > DEBUG 10191 [fop ] (): setting up fonts > ERROR 10191 [fop ] (): Unknown formatting object ^html > Your transformation transforms your XML to XHTML. You have to write a transformation which transforms into XSLFO. FOP can not render XHTML (it would be named XHTMLP if it could) J.Pietschmann --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]