xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: Would an extension to print Gantt charts work?
Date Thu, 01 Nov 2007 14:25:15 GMT
Apache FOP is primarily an implementation of the XSL-FO standard, so it
converts XSL-FO to some output format (PDF, PS, PCL etc.). These are the

Now, through the standard formatting objects fo:external-graphic and
fo:instream-foreign-object, the XSL-FO spec allows foreign XML formats
and images to be combined with XSL-FO documents. For example, FOP has a
plug-in which lets you use SVG inside XSL-FO. The SVG is interpreted by
Apache Batik and converted to a suitable target format for a renderer
(an output format implementation).

An example of an external extension for Apache FOP is Barcode4J, a
barcode generator. Barcode4J can itself create various output formats:
SVG, Java2D/AWT, EPS and bitmaps. The FOP plug-in selects the optimal
output format depending on the renderer in use. For PostScript output,
the plug-in renders the barcodes to Encapsulated PostScript (EPS). For
PDF output, it paints the barcode to a Graphics2D instance which happens
to have a PDF backend.

On Java2D/AWT generation:
FOP contains a Java2DRenderer which paints the internal representation
of the processed XSL-FO document (the area tree) using a Graphics2D
instance. Graphics2D is the main interface of the Java2D infrastructure.
With this Java2DRenderer, we can do all sorts of things: We can subclass
it and create bitmaps (PNGRenderer, TIFFRenderer). In that case the
Graphics2D has a BufferedImage in the back. Finally, the BufferedImage
is encoded as a PNG or TIFF file. Another subclass of Java2DRenderer is
the AWTRenderer which ultimately has a AWT/Swing panel in the back. So
this is used to display a FO document in a GUI application. We can also
print to a printer this way.

If you now want to create an extension for Gantt charts, the recommended
approach is as follows:
- Get or write a library which can produce Gantt charts from XML. You
need to have the Gantt data as XML in order to embed it in the XSL-FO
- Make sure you can produce either SVG or a bitmap from the Gantt data
using that library. More universal would be to have the library paint
the Gantt chart using Java2D (Graphics2D).
- Put the whole thing in a FOP extension.

There's no formal documentation about writing such extensions, yet. But
there are a few examples where you can start from:
- The simplest example is the Plan extension which you can find in FOP's
examples/plan directory. The Plan extension creates an SVG document from
some custom XML and passes it to FOP.
- The old MathML extension in FOP's examples/mathml directory.
- More serious examples can be found in Barcode4J (barcodes) and JEuclid
(MathML). Barcode4J is probably to most comprehensive and most flexible
example, but it therefore has its complexity.

Jeremias Maerki

On 01.11.2007 14:50:51 Fred Janon wrote:
> I just started looking at FOP, therefore I don't really understand what it
> can or cannot do. My attention was caught by the different formats that can
> be generated. I would like to know if FOP with a custom extension could
> generate Gantt charts? I am interested in pdf, PCL and Java/AWT generation.
> Is there any documentation about the Java/AWT generation? I don't understand
> what FOP would generate for AWT.
> Thanks
> Fred

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

View raw message