You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Fabian Zeindl <fa...@xover.htu.tuwien.ac.at> on 2007/07/11 22:36:57 UTC

fop and SWT

hi,

 I'm developing an application using SWT and I chose fop for printing.
Is it possible to use SWT's Printer object directly with fop? A
workaround, that came into my mind, was to use fop to get png-output and
print the png using SWT's methods. Am I forced to use AWT in the latter
case? (I don't want an additional dependency in my application.)

thanks in advance
fabian

Re: fop and SWT

Posted by Fabian Zeindl <fa...@xover.htu.tuwien.ac.at>.
J.Pietschmann schrieb:
> It is certainly possible, but it would require writing a new renderer
> which uses the appropriate SWT graphics functions. Starting off with
> the AWT/Print renderer, it is probably not all that difficult, but
> there are still lots of minor and a few major differences between
> SWT and AWT.

I think the easiest way is to subclass Java2DRenderer just like
PNGRenderer does, and convert the BufferedImages that are returned by
getPageImage to SWT-Images. Here's a snippet for the latter operation:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet156.java?revision=HEAD

I first intended to avoid AWT-dependency, but since it's packaged in
default-jvm that's nonsense ;).

fabian

Re: fop and SWT

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Fabian Zeindl wrote:
>  I'm developing an application using SWT and I chose fop for printing.
> Is it possible to use SWT's Printer object directly with fop?

It is certainly possible, but it would require writing a new renderer
which uses the appropriate SWT graphics functions. Starting off with
the AWT/Print renderer, it is probably not all that difficult, but
there are still lots of minor and a few major differences between
SWT and AWT.

J.Pietschmann

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