Apache FOP and the Java2D API

This page describes FOP's design around the Java2D API.

Use cases

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.

XSL-FO Debugger

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.

PrintRenderer

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.

Bitmap production

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)

Package structure

That means that the java2d package provides the (abstract) technical foundation and the other three packages provide the concrete output paths.