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 10:03:18 UTC
RE : Re: FOP and servlet
>You haven't told us what is going wrong.
I use Apache Web Server 1.3 and JServ 1.2 (with JDK 1.2.2)
>What do you see in your servlet engine logs? (stderr and stdout)
in jserv.log :
[02/02/2001] FOPServlet: destroy (x5)
[02/02/2001] FOPServlet: init (x5)
in mod_jserv.log : nothing
>What is the behaviour seen by the client?
Acrobat Reader is launched but displays nothing.
If I genrate a file as output, everything works well.
>Does your FO file work from the command line?
I don't understand what you mean.
>PS Try doing:
> driver.setWriter(out);
> driver.format();
> driver.render();
It is what I've done (I made a mistake in copying the lines
of the code).
>instead of the last three lines you have. I think that maybe FOP is
>rendering
>your pdf - but not to the servlet's response object/output stream.
--- Ext.ZXSPRCR2A015@tls.mms.fr wrote:
> I try to write a servlet that converts fo-file
> to PDF, launching Acrobat Reader to see the result.
>
> I read CommandLine.java that creates a pdf-file,
> and Xalan example that converts xml-file to HTML,
> launching a browser to see result, but can't obtain
> the result I want.
>
> Any idea how to modify this code (without
> exception catching) :
> ----------------------------------------------
> public void doPost(HttpServletRequest request,
> HttpServletResponse response)
> throws ServletException, IOException
> {
> PrintWriter out = response.getWriter();
> 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(src));
> driver.format();
> driver.setWriter(out);
> driver.render();
> out.close();
> }
If you had written such a servlet, can you send me your
code.
Regards,
Laurent
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org