xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@swisslab.de
Subject AW: FOP 0.91 Beta - Previewer problem
Date Tue, 11 Apr 2006 11:27:52 GMT
My suggestion is to use InternetExplorer within a OLE container. If your
using windows.... :)

-----Urspr√ľngliche Nachricht-----
Von: Debasish Jana [mailto:debasishj@anshinsoft.com]
Gesendet: Dienstag, 11. April 2006 13:07
An: fop-users@xmlgraphics.apache.org
Betreff: RE: FOP 0.91 Beta - Previewer problem


Hi:

Thanks for your prompt answer. Can you please pass me a sample code to
invoke the renderer in an AWT window (JPanel or JFrame). Suppose I have a
XSL-FO document which I would like to render to say PDF using FOP renderer
and like to preview it? How can I do it?

Pls help.

Regards,

Debasish

-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Monday, April 10, 2006 10:46 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: FOP 0.91 Beta - Previewer problem

(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/fo
p/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


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



---------------------------------------------------------------------
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