Thanks to all of you, who helped me with some very good ideas about my
embedding problem. I'm still not done with it, but it seems the problem is
rather my environment, i.e. the OC4J Container V2.0 (not sure you all know
it, though). It was "refined" by oracle, which basically means, that the
container now "needs" some special libs, especially one xmlparsv2.jar made
by oracle. Obviously that messes up my intention to get fop going. But I
dont give up and hope to break through that wall.

thanks again to all of you kind people and I big applause for this very fast
and kind mailing list.
I let you know, what I will find out. Maybe there are some other OC4J users
out there...

Greetings
Olli

-----Ursprungliche Nachricht-----
Von: J.Pietschmann [mailto:[EMAIL PROTECTED]
Gesendet: Samstag, 13. April 2002 14:44
An: [EMAIL PROTECTED]
Betreff: Re: Embedding problem


Oliver Charlet wrote:
> I too have a problem embedding fop in my application.

The standard procedure in case of trouble with an embedded
FOP is:
- Run the transformation from the command line in order
   to generate a FO file. This ensures the transformation is
   ok.
- Run the produced FO file from the command line and see
   whether it produces the desired PDF. This ensures that
   the FO is correct and that you didn't hit any FOP bugs.
- Put som code into your application which runs the FO
   file through FOP, *without* the transformation. This
   way you'll see whether you have problems with the
   FO setup in the embedding and whether you can reference
   ell external ressources (fonts, graphics etc.)
- Try to run the transfomation *without* the formatting
   step. The code is a one-liner :)
       TransformerFactory.newInstance().newTransformer(
         new StreamSource(new File("foo.xsl"))).transform(
           new StreamSource(new File("foo.xml")),
           new StreamResult(new File("foo.fo")));
   This will catch problems with the XSLT processor setup
   and access to ressources referenced during the transformation
   (DTD and external entities in the original XML, ressources
   accessed with document(), extensions etc.)
- Run FOP+XSLT embedded as the final step.

 > the following code (used inside a servlet) produces a zero byte pdf-file.
 > xmlFile and xslFile hold an absolute Path to the input-files.
...
 > It seems to me, that the generation is not started at all.

Common problems:
1. If you have a DOCTYPE declaration referring to an external
  DTD in your original XML or a PI linking the document to an
  XSchema, either remove it or check whether the ressources are
  still accessible.
2. Close the PDF file explicitely, or flush it:
    driver.render(parser, inputHandler.getInputSource());
    fout.close();
  The Java runtime closes files upon garbage collecting them,
  and this wont happen as long as the Driver object is
  refereced somewhere.

HTH
J.Pietschmann

Reply via email to