You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Eric Douglas <ed...@blockhouse.com> on 2011/04/07 17:17:58 UTC

FOP Preview

FOP has a PreviewPanel window but it creates it's own renderer and
transformer which can run extremely slow, especially if you're running
client-server like I am where output can normally be renderered on a
server and the preview needs to display on the client PC.

I wrote my own custom preview window which I think is pretty smooth.
For the window itself I just used swing.  It uses the PNGRenderer to
create the output and gets the pages as images which are then
serializable so they can be loaded into the window which can be on
another machine, or they could still be saved as image files.  The pages
can be loaded into the preview window one at a time as needed so you
don't have to wait for them to serialize.  For a zoom I just used the
built in java.awt.Graphics2D to resize instead of generating the output
all over with the transform, so it can be a little bit blurry but is
still perfectly viewable.  If anyone is interested in seeing any code I
wrote using FOP to get any ideas for adding something to the project, or
just if it's something you might want to use yourself, let me know.  I
also wrote a custom report writer program which does a lot of cool
things, using FOP to generate output, along with pdfbox to print.