Hi Eugen

Assuming you're using Apache FOP 1.0 or later, I would suggest to you to
write a set of plug-ins for the Apache XML Graphics Commons image loader
framework. The documentation for that is found here:
http://xmlgraphics.apache.org/commons/image-loader.html

That's our new infrastructure for handling images. And your charting XML
is nothing other than an image in XML. A good example of such a set of
plug-ins can be found in Barcode4J:
http://barcode4j.cvs.sourceforge.net/viewvc/barcode4j/barcode4j/src/xmlgraphics-commons/

You can see multiple ImageConverter implementations there. One converts
[1] a generic XML document into an ImageBarcode [2]. And you would
create something like an ImageChart. Furthermore, I'd go the Java2D
route (Graphics2D), so you'd add an ImageConverter which takes an
ImageChart and produces an ImageGraphics2D [3] (The code in there
basically paints your chart against a Graphics2D object). The latter can
be processed by FOP's PDF support to create high-quality vector graphics
without you having to learn about PDF specifics. The nice side-effect is
that it won't only work for PDF, but also for all other output formats
supported by FOP.

[1] 
http://barcode4j.cvs.sourceforge.net/viewvc/barcode4j/barcode4j/src/xmlgraphics-commons/java/org/krysalis/barcode4j/image/loader/ImageConverterBarcodeXML2Barcode.java?view=markup
[2] 
http://barcode4j.cvs.sourceforge.net/viewvc/barcode4j/barcode4j/src/xmlgraphics-commons/java/org/krysalis/barcode4j/image/loader/ImageBarcode.java?view=markup
[3] 
http://barcode4j.cvs.sourceforge.net/viewvc/barcode4j/barcode4j/src/xmlgraphics-commons/java/org/krysalis/barcode4j/image/loader/ImageConverterBarcode2G2D.java?view=markup

If you don't plan to put charts in external files (i.e. you use only
fo:instream-foreign-object), you can omit the Preloader, LoaderFactory
and Loader, I think. The image converters should be enough.

If there's something that our PDFGraphics2D can't handle, we can take a
closer look at this again.

HTH

On 03.01.2011 16:55:32 gen1986 wrote:
> 
> Hi,
> 
> I'm working on a project where I have to extend FO to support custom tags
> for drawing charts.
> For doing so I've extended ElementMapping and created my custom
> ContentHandlerFactory, etc.
> Until here it's ok. I can get all the infos about the chart from the xsl-fo
> template.
> 
> My problem is that I want now to write the chart as a stream to the PDF, but
> I don't know which fop classes to use for doing it the right way. Any help
> is welcome.
> 
> If my problem isn't clear enough I can give more explanations, just let me
> know ;)
> 
> Thanks,
> 
> Eugen
> -- 
> View this message in context: 
> http://old.nabble.com/how-to-extend-the-rendering-part-of-fop-tp30579066p30579066.html
> Sent from the FOP - Users mailing list archive at Nabble.com.


Jeremias Maerki


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

Reply via email to