You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Ex...@tls.mms.fr on 2001/02/02 17:01:32 UTC

Re: FOP and servlet (end and doc)

  I found what was wrong : my client (Navigator 4.05 on Unix).
I tried with IE 5.0 on NT 4.0 and got a good result.

  To avoid lots of future question on that list,
can somebody add in documentation (in Running FOP page) an
example of servlet, like for Xalan, something like :

> public void doPost(HttpServletRequest  request,
> 		     HttpServletResponse response)
> 	throws ServletException, IOException
> {
>   String fo_filename = "file:/dir/sample.fo";
>   response.setContentType("application/pdf");
>   parser = (XMLReader)
> Class.forName("org.apache.xerces.parsers.SAXParser").newInst ance();
>   driver = new Driver();
>   driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer",
version);
>   driver.addElementMapping("org.apache.fop.fo.StandardElementM
apping");
>   driver.addElementMapping("org.apache.fop.svg.SVGElementMappi ng");
>   driver.addPropertyList("org.apache.fop.fo.StandardPropertyLi
>                           stMapping");
>   driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMa
>                           pping");
>   driver.buildFOTree(parser, new InputSource(fo_filename));
>   driver.format();
>// FOP 0.15
>//   driver.setWriter(new PrintWriter(response.getOutputStream()));
>// or
>//   driver.setWriter(response.getWriter());
>// FOP 0.16
>   driver.setOutputStream(new PrintWriter(response.getOutputStream()));
>   driver.render();
> }

Note on common problems : 
  Use of response.getWriter() and, in same method,
response.getOutputStream() generates an IllegalState exception.

               Regards,
                    Laurent
 

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: FOP and servlet

Posted by Fotis Jannidis <fo...@lrz.uni-muenchen.de>.
From:           	Ext.ZXSPRCR2A015@tls.mms.fr

>   To avoid lots of future question on that list,
> can somebody add in documentation (in Running FOP page) an
> example of servlet, like for Xalan, something like :

A servlet example which even works for IE (thanks Kelly for both) 
can be found in xml-fop/docs/examples/embedding and there is a 
small explanation in the documentation in the section embedding. 

Fotis

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org