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 pa...@sgcib.com on 2004/07/08 15:57:50 UTC

Integrating FOP in a Project

Hi evrybody !

excuse me for my english but i'm french so i will try to be clear but ...

so i have a problem with using fop. I work on an application in Java 1.4
and when i use fop to create a file on the file system in a java program it
works
BUT i can't do the same thing with my server. I would generate an PDF in a
servlet with this code :

public static void doPDF(Document xml, Document xsl, Document xslfo,
OutputStream outputstream) throws Exception
{
      DOMSource transformXSLT = new DOMSource(xsl);
      DOMResult resultatXSLFO = new DOMResult(xslfo);
      DOMSource sourceXML = new DOMSource(xml);

      logger.warn("XML TO FO TRANSFORMATION BEGIN");
      gcpmrds.xsl.xslTransform.transformUri(
                  sourceXML,
                  transformXSLT,
                  null,
                  resultatXSLFO );
      logger.warn("XML TO FO TRANSFORMATION END");

      logger.warn("FO TO PDF TRANSFORMATION BEGIN");
      File pdffile = new File("C:/Resultat.pdf");
      OutputStream out = new java.io.FileOutputStream(pdffile);
      out = new java.io.BufferedOutputStream(out);
      logger.warn("AAAAA");
      //Driver driver = new Driver((InputSource)xslfo,out);
      Driver driver = new Driver();
      logger.warn("AAAAA");
      driver.setRenderer(Driver.RENDER_PDF);
      driver.setInputSource((InputSource)xslfo);
      driver.setOutputStream(out);
      driver.run();
      out.close();
      logger.warn("FO TO PDF TRANSFORMATION END");
}

And my problem is that i haven't any exception or error but the program
never go out of the "Driver driver = new Driver()" and if i use "Driver
driver = new Driver((InputSource)xslfo,out)" it's the same problem so i
don't know what's the matter.
Perhaps i've got forget a jar ?

thanks for help !





******************************************************************
The sender's email address has changed to 
firstname.lastname@ sgcib.com. You may want to update your 
personal address book. Please see http://www.sgcib.com for more 
information.
                               **
This message and any attachments (the "message") are confidential
and intended solely for the addressee(s). Any unauthorised use or
dissemination is prohibited. E-mails are susceptible to alteration.
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates
shall be liable for the message if altered, changed or falsified.
                         ***************
L'adresse mail  de votre correspondant a change en prenom.nom@ sgcib.com.
Il est recommande de mettre a jour votre carnet d'addresse
personnel.Pour plus d'informations, aller  sur http://www.sgcib.com
                               **
Ce message et toutes les pieces jointes (ci-apres le "message")
sont confidentiels et etablis a l'intention exclusive de ses
destinataires. Toute utilisation ou diffusion non autorisee est
interdite. Tout message electronique est susceptible d'alteration.
La SOCIETE GENERALE et ses filiales declinent toute
responsabilite au titre de ce message s'il a ete altere, modifie
ou falsifie.
******************************************************************


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


Re: Integrating FOP in a Project

Posted by "J.Pietschmann" <j3...@yahoo.de>.
paul.bezault@sgcib.com wrote:
>       File pdffile = new File("C:/Resultat.pdf");

Does your server have a C: drive? :-)
Furthermore, it's almost always a waste to use DOM trees for
intermediate XML documents. Check out the code samples on the
FOP website for more information.

But neither of these appears to be your problem:
> And my problem is that i haven't any exception or error but the program
> never go out of the "Driver driver = new Driver()"

This method doesn't do much except setting up the element
mapping tables. In particular it doesn't do anything to
the output stream. It tries to get a class loader for accessing
the mapping property files though, which might be a problem.
Whats your environment on the server? Are there any user written
class loaders or such? Security policies?

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


Re: Integrating FOP in a Project

Posted by Glen Mazza <gr...@yahoo.com>.
--- "J.Pietschmann" <j3...@yahoo.de> wrote:
> Glen Mazza wrote:
> > driver.initialize();
> 
> 
> There is no initialize() method in the Driver class
> in FOP 0.20.5.
> 
> J.Pietschmann
> 

Thanks--that's good to know.  I just made that method
private in HEAD, because it is already called in
Driver for all of the various render()/run() methods
that can be activated within it.

Glen


Re: Integrating FOP in a Project

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Glen Mazza wrote:
> driver.initialize();


There is no initialize() method in the Driver class in FOP 0.20.5.

J.Pietschmann


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


Re: Integrating FOP in a Project

Posted by Glen Mazza <gr...@yahoo.com>.
I think you're missing one line of code:

--- paul.bezault@sgcib.com wrote:
>       logger.warn("AAAAA");
>       //Driver driver = new
> Driver((InputSource)xslfo,out);
>       Driver driver = new Driver();

driver.initialize();

>       logger.warn("AAAAA");
>       driver.setRenderer(Driver.RENDER_PDF);
>       driver.setInputSource((InputSource)xslfo);
>       driver.setOutputStream(out);
>       driver.run();

Glen

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