Apache FOP and the Java2D API
This page describes FOP's design around the Java2D API.
AWTRenderer + viewer
The -awt command line switch renders the pages generated by the layout engine to a Swing window. This Swing window serves as default viewer for the -awt switch and as an example of how to embed the AWTRenderer into a AWT/Swing application.
A renderer that lets you highlight specific FO objects (box, baseline, etc) to allow you to debug your xslt-stylesheet. Much like the NET. implementation of Altsoft.
The -print command line switch renders the pages generated by the layout engine directly to a printer. The PrintRenderer can also be used embedded in an application to print XSL-FO documents (either through the older AWT PrintJob or through the newer JPS (Java Printing System). The PrintRenderer provides a Printable implementation for that purpose.
The output from the layout engine is converted to bitmap images as in Oleg Tkachenko's TIFFRenderer.
PDF, PS etc. through Java2D
The above PrintRenderer can also be used to create PDFs or PostScript files by printing through JPS. The Graphics2D subclasses PDFDocumentGraphics2D and PSDocumentGraphics2D can indirectly be used for that purpose by writing a JPS StreamPrintService.
(BTW this is the approach Peter West intends to take with his Folio)
- org.apache.fop.render.java2d: The basic renderer that renders the area tree to a Graphics2D interface.
- org.apache.fop.render.awt: Home of the AWTRenderer. Extends the Java2DRenderer to provide easy embeddability into AWT/Swing applications.
- org.apache.fop.render.awt.viewer: Example/Default viewer window that uses the AWTRenderer to display the rendered pages. Also used by the -awt command line switch.
- org.apache.fop.render.print: PrintRenderer extends the Java2DRenderer to provide printing support (Printable interface, from/to-parameters etc.). Integration with the older AWT PrintJob and the newer JPS.
- org.apache.fop.render.bitmap: BitmapRenderer (or TIFFRenderer) that generates multi-page bitmap images by subclassing Java2DRenderer.
That means that the java2d package provides the (abstract) technical foundation and the other three packages provide the concrete output paths.