You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Subrata Hazra <su...@gmail.com> on 2009/05/27 14:32:05 UTC

Custom FOP Extension

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.
-- 
View this message in context: http://www.nabble.com/Custom-FOP-Extension-tp23741578p23741578.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: Custom FOP Extension

Posted by Tim Landscheidt <ti...@tim-landscheidt.de>.
Subrata Hazra <su...@gmail.com> 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.

Depending on your workflow, have you looked into generating
the image with XSLT as SVG to be included with
<fo:instream-foreign-object>?

Tim


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


Re: Custom FOP Extension

Posted by Andreas Delmelle <an...@telenet.be>.
On 28 May 2009, at 00:24, Andreas Delmelle wrote:

> On 27 May 2009, at 14:32, Subrata Hazra wrote:
>
>> Can anybody help me with step-by-step guide for writing own FOP  
>> extension.

Just noticed, I forgot to post the most important related link:
http://xmlgraphics.apache.org/fop/dev/extensions.html


Regards

Andreas

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


Re: Custom FOP Extension

Posted by Andreas Delmelle <an...@telenet.be>.
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  
org.apache.fop.fo.flow.AbstractGraphics.[**]
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  
that...)


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

HTH!

Andreas

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