You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by VIRUEGA Pierre <pi...@sofrecom.com> on 2001/07/16 12:57:40 UTC

FOP in a servlet

Hello,
I need some help about how to embed FOP in a servlet.
I know there is an example on the FOP site but it is only with one parameter,
the same as:
Fop foo.fo foo.pdf

and what I want to do is similar to:
Fop -xml foo.xml -xsl foo.fo foo.pdf

I found the following code on the FOP FAQ as an example =

   response.setContentType("application/pdf");
   Driver d = new Driver();
   // this doesn't compile
   //Driver.setRenderer(RENDER_PDF);

   InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
   XMLReader parser = inputHandler.getParser(); // error at getParser
   d.buildFOTree(parser, inputHandler.getInputSource());
   d.format();
   d.setOutputStream(response.getOutputStream());
   d.render();

But it failed  with the message =
java.lang.NullPointerException
        at org.apache.fop.apps.InputHandler.createParser(InputHandler.java:58)
        at
org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:117)
        at NewFopServlet.buildPDFDoc(NewFopServlet.java:157)
        at NewFopServlet.doGet(NewFopServlet.java:96)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

Does anyone has solved the same problem?
Thks
Pierre

**************************************************************************************************
This e-mail contains confidential information or information belonging
to Sofrecom and is intended solely for the addressees.
The unauthorised disclosure, use, dissemination or copying (either whole
or partial) of this e-mail, or any information it contains, is prohibited.
E-mails are susceptible to alteration and their integrity cannot be guaranteed.
Sofrecom shall not be liable for this e-mail if modified or falsified.
If you are not the intended recipient of this e-mail, please delete it
 immediately from your system and notify the sender of the wrong delivery
and the mail deletion.

** eSafe scanned this email for viruses, vandals and malicious content **
**************************************************************************************************