xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Delmelle <andreas.delme...@telenet.be>
Subject Re: Custom FOP Extension
Date Wed, 27 May 2009 22:24:03 GMT
On 27 May 2009, at 14:32, Subrata Hazra wrote:

> Can anybody help me with step-by-step guide for writing own FOP  
> extension.
> I want to write some extension where fop will output an image  
> parsing fo
> document like this
> <fo:block>
> <ns:img xmlns="some URI" width="100" height="100">
> <ns:bar height="10">bar1</bar>
> <ns:bar height="10">bar2</bar>
> </ns:img>
> Internally I want to generate BufferedImage from Graphics2D then  
> forward the
> same to FOP.

Apart from what Manuel and Tim already suggested, what you could do,  
is implement it as a custom FO extension. SVG can be taken as an  
example, although SVG is only implemented to work if it is child to a  
fo:instream-foreign-object. It does, however, offer a fairly good  
picture of all the work that needs to be done to process foreign XML  
(not in the default FO namespace). The Barcode4J extension may also be  
of interest here.[*]

On the FOP side, be sure to take a look at  
org.apache.fop.fo.flow.InstreamForeignObject and its superclass  
Chances are you can reuse a lot of the existing code.
I'm guessing that, with a bit of imagination, it should be possible to  
implement your extension as a subclass of AbstractGraphics (so you can  
reuse the same LayoutManager; otherwise, you would need to provide an  
extension LM together with the extension node, and add a mapping for  

[*] http://barcode4j.sourceforge.net/
[**] http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java?revision=679326



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

View raw message