xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: FOP 0.91 Beta - Previewer problem
Date Mon, 10 Apr 2006 17:16:29 GMT
(comments inline...)

On 10.04.2006 14:11:08 Debasish Jana wrote:
> Hi:
>  
> We are using FOP 0.91 Beta for rendering XSL-FO documents toPDF or RTF
> or other supported formats. To use the previewer, we are using
> the following code snippet:
> ------
> // file is the output file created earlier, and fo is theinput stream having XSL-FO source
> FOP fop = new Fop(MimeConstants.MIME_FOP_AWT_PREVIEW);
> BufferedOutputStream out = new BufferedOutputStream(newFileOutputStream(file));
> fop.setOutputStream(out);
> fop.getUserAgent().setOutputFile(file);

Why do you set an OutputStream if the file is displayed on screen?

> // Setup JAXP using identity transformer
> TransformerFactory factory = TransformerFactory.newInstance();
> Transformer transformer = factory.newTransformer(); //identity transformer
>                                     
> // Setup input stream
> Source src = new StreamSource(fo);
>                                     
> try {
> // Resulting SAX events (the generated FO) must be pipedthrough to FOP
> Result res = new SAXResult(fop.getDefaultHandler());
>             
> // Start XSLT transformation and FOP processing
>             
> transformer.transform(src, res);
> }
> catch(Exception ex)
> {
> } 
> ------
>  
> While hooking up the previewer, we face the following problems.
>  
> (1)     Thepreviewer is shown in a separate JFrame window, which shows
> the preview, but onclosing the entire application of ours (running in a
> separate JFrame) closesand the application comes out. Is it an
> acceptable behavior? Or is there anyworkaround?

Sorry, but I don't understand what you're trying to say.

> (2)     In case wewould like to fit the previewer window inside a
> JPanel, how can we do that, sothat we can control stopping or terminating the
> preview window wheneverrequired.

I'd look at the source code of PreviewDialog. It should contains
everything you need to use the preview panel in your own windows,
because that's just what this class does.

http://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java

Since this is not the first time this question pops up, it would be good
if someone would write a short Wiki page on how to do that. Or maybe
even an example class we could include in our embedding examples.

> (3)     Is there anyother way of using the AWT previewer or are we
> doing any mistake to use thepreviewer elegantly?

One thing would probably be to instantiate the AWTRenderer yourself and
to pass it to FOP using FOUserAgent.setRendererOverride(). I'm sorry I
can't help more. I'm not so much into GUI programming lately so that I'm
not a big help without wasting many hours first.

> An early reply would be sincerely appreciated.


Jeremias Maerki


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


Mime
View raw message