> I could not get "driver.setLogger(logger);" to compile.  
> The versions I have of FOP (0.19 and 0.20.1) do not have a
                              ^^^^^^^^^^^^^^^

  Wow!  You neglected to mention that, didn't you? ;-)  I guess
I had to be more specific about which version of FOP I use when
I posted the code.

  0.20.1 never worked for me at all, I had to build from CVS
until 0.20.2RC came out.  With 0.19 the method works, but
FOP doesn't really produce the PDF on the fly, instead it
builds the whole FO tree in memory, and after the parsing is
done you have to call 

        driver.format();
        driver.render();

In other words, you don't buy much by using SAX events with 0.19.
0.20.2RC has a major improvement for more streamlined processing.

Yuri.

-----Original Message-----
From: Jim Urban [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 19, 2001 3:02 PM
To: [EMAIL PROTECTED]
Subject: RE: New FOP Code Don't Work


The method that calls my renderFo creates the iInputSource as follows:
Source iInputSource= new StreamSource(new StringReader(xmlString));

My translator is cached, and worked fine with my orginal code.

I get no exceptions.  Where would I see error messages?

I could not get "driver.setLogger(logger);" to compile.  The versions I have
of FOP (0.19 and 0.20.1) do not have a
org.apache.fop.apps.Driver.setLogger(org.apache.log.Logger) method.

I am using Xalan/Xerces, does this matter?

Jim

-----Original Message-----
From: Shkuro, Yuri [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 19, 2001 1:42 PM
To: '[EMAIL PROTECTED]'
Subject: RE: New FOP Code Don't Work


As far as I can tell, the code is correct (although you didn't indicate
how you create iInputSource).  Are you sure you are not getting any
exceptions, error messages, etc.?


> -----Original Message-----
> From: Jim Urban [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 19, 2001 2:38 PM
> To:   [EMAIL PROTECTED]
> Subject:      New FOP Code Don't Work
>
> Recently someone suggested using SAX events to run XML through XSLT then
> FOP and to send the PDF back to the browser from a servlet.  I tried
> implmenting this (see code below) but all I don't get any output back.  I
> even routed the output to a file, and the file was empty.  My old code
> worked great, but I was told I was wasting memory.  Can someone tell me
> why this code does not work?
>
> Thanks,
>
> Jim Urban
> Product Manager
> Netsteps Inc.
> Suite 505E
> 1 Pierce Pl.
> Itasca, IL  60143
> Voice:  (630) 250-3045 x2164
> Fax:  (630) 250-3046
>
>
>       public void renderFO(Transformer pdfTransformer, Source
> iInputSource, HttpServletResponse uResponse)
>       {
>               try
>               {
>                       OutputStream out = uResponse.getOutputStream();
>                       uResponse.setContentType("application/pdf");
>                       Driver driver = new Driver();
>                       driver.setRenderer(driver.RENDER_PDF);
>                       driver.setOutputStream(out);
>                       // -------
>                       // Create SAXResult based on FOP Driver content
> handler
>                       // which will accept SAX events and build FOP tree
>                       // -------
>                       Result saxResult = new
> SAXResult(driver.getContentHandler());
>
>                       // Use the Transformer to transform an XML Source
> and
>                       // send the output to a Result object. Implicitely
> it will
>                       // create the FOP tree by firing SAX events.
>                       pdfTransformer.transform(iInputSource, saxResult);
>
>                       // The user is already viewing the PDF!
>                       out.flush();
>                       out.close();
>               }
>               catch (TransformerException e1)
>               {
>                       System.err.println("Unable to generate PDF:  " +
> e1.toString());
>               }
>               catch (IOException e2)
>               {
>                       System.err.println("File error:  " + e2.toString());
>               }
>       }
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to