Apache FOP Servlet - How to change title?
Posted on 2004-08-26
I have a basic FOP Servlet which works well, except that when I try to save the PDF that's generated the filename is always 'FOPServlet.pdf'
This name is being read from the browser window title, so my question is; can someone tell me how to change the title of the browser window?
Note that I can't use:
PrintWriter out = response.getWriter();
As I normally would for a servlet window title, because of the FOP processing element.
Here is the FOP servlet code:
Driver driver = new Driver();
//Setup a buffer to obtain the content length
ByteArrayOutputStream out = new ByteArrayOutputStream();
Source xsltSrc = new StreamSource(new File( xslParam ));
Transformer transformer = this.transformerFactory.newTransformer(xsltSrc);
//Make sure the XSL transformation's result is piped through to FOP
Result res = new SAXResult(driver.getContentHandler());
Source src = new StreamSource( new StringReader( xmlParam ) );
//Start the transformation and rendering process
//Send content to Browser