Hi:

 

We are using FOP 0.91 Beta for rendering XSL-FO documents to PDF 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 the input stream having XSL-FO source

FOP fop = new Fop(MimeConstants.MIME_FOP_AWT_PREVIEW);

BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));

fop.setOutputStream(out);

fop.getUserAgent().setOutputFile(file);

                                   

// Setup JAXP using identity transformer

TransformerFactory factory = TransformerFactory.newInstance();

Transformer transformer = factory.newTransformer(); // identity transformer

                                   

// Setup input stream

Source src = "" StreamSource(fo);

                                   

try {

// Resulting SAX events (the generated FO) must be piped through 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)     The previewer is shown in a separate JFrame window, which shows the preview, but on closing the entire application of ours (running in a separate JFrame) closes and the application comes out. Is it an acceptable behavior? Or is there any workaround?

(2)     In case we would like to fit the previewer window inside a JPanel, how can we do that, so that we can control stopping or terminating the preview window whenever required.

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

 

An early reply would be sincerely appreciated.

 

Warm regards,

 

Debasish Jana

 

 

 

Reply via email to