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.
My first problem is in using the right input; I can't make FOP use a Stream as input source, the critical constructor being XSLTInputHandler(File, File) - has anybody found a possibility to use a stream as input? Currently, my filter writes to a temp file before calling FOP; this is ugly, and I want to avoid it, as I have all my input data in a ByteArrayInputStream already and FOP is well able to write to a ByteArrayOutputStream. 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 The message text of the exception says: Root element must be root, not (none):html This seems to mean my DTD, which I deleteted; if I use a valid DTD: <!DOCTYPE xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> FOP prepends 'xhtml' to the error messages (i.e. "Unknown formatting object xhtml^html" and "Root element must be root, not xhtml:html"). I don't want to send the complete sources, as they are quite long; can anybody make any sense out of these errors anyway? Keep in mind that I can output a perfectly good PDF-File from the command line using the saved source from the HTML-Page and my stylesheet; I also made sure that the HTML-Source and the temp file as written by the filter have an identical content, so my temp file is not filtered to death by a Java Stream. Any hint or idea is appreciated... Hans --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]