Thanks Jeremias, thanks Warren! It helps a lot.
Your two following points made it clearer for me:
"the answer here is to write your
Gantt generator to create XSL-FO, which you may then translate into
something else with FOP"
"the XSL-FO spec allows foreign XML formats
and images to be combined with XSL-FO documents"
I had looked at the Barcode extension code but could not figure out how it was involved in the process. A couple of sequence diagrams would have helped! I will have another look at the Plan extension, it is probably a good starting point for understanding extensions more. Thanks also for the Java2D/AWT explanation, somehow I was thinking that it would generate some AWT components but I guess just generates the content of an AWT component.
I have a database with task objects with their name, start/end dates, completion, etc. I want to compose (to print it via pdf, PCL) a large document (10+ pages) containing a Gantt chart composed of a table with rows of text and numbers, bars (graphics), columns with dates, a legend and some notes, in a very similar way as Microsoft Project. FOP would help me formatting the document (margin, centering...) and with the pagination after I compose an XML document that describes the content of the document but not the pagination? FOP could generate the pdf document for example with 10 pages and the page number with my content segmented on each page? Would I have to create an extension to draw the graphics for the task bars?
Sorry about all these basic questions, but I have the feeling that FOP can save us a lot of time in our project but it's always difficult to figure out the use and limits of a technology without spending quite some time on it and I don't have much of that.
Thanks for your help again.
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.
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.
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com