I'm using the AWTRenderer the following way to produce
a preview image in a JPanel.

public void renderToImage(byte []foFile,ImagePanel panel) {
 try {
  driver.setInputSource(new InputSource(new ByteArrayInputStream(foFile)));
  URL url =
getClass().getResource("/org/apache/fop/viewer/resources/messages.en");
  AWTRenderer renderer = new AWTRenderer(new
SecureResourceBundle(url.openStream()));
  renderer.setComponent(panel);
  driver.setRenderer(renderer);
  String baseDir =
"file:///"+ResourcePool.getInstance().getImageDirectory().getAbsolutePath()+
"/";
  Configuration.put("baseDir", baseDir);
  driver.run();
  panel.setImage(renderer.getLastRenderedPage());
  panel.repaint();
 } catch (FileNotFoundException fnfex) {fnfex.printStackTrace();}
   catch (IOException ioex) {ioex.printStackTrace();}
   catch (FOPException fopex) {fopex.printStackTrace();}
}

ImagePanel is a simple JPanel that displays a (Buffered)Image in
its paint() method.

Alex


-----Ursprüngliche Nachricht-----
Von: alex elsholz [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 31. Dezember 2002 12:49
An: [EMAIL PROTECTED]
Betreff: Previewer


Hi,

whats the reason placing the report on a frame and not on a panel?

i think here should be a panel and a controller-class for this.

because some developer want use the previewer on a dialog,
some other in a internal frame ...

mfg alex


--
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!


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


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

Reply via email to