Search code examples
xsl-foapache-fopafp

Examples using the AFP renderer in Apache FOP?


Does anybody know if there are some example xsl-fo files out there on the net which show how to use the tags that the AFP output engine adds to Apache FOP?

This page http://afp-renderer.sourceforge.net/afp-extensions.html does a good enough job of listing what the extra extension tags are, but I have no idea where they fit in the existing schema of xsl-fo tags.


Solution

  • The page you mentioned is quite old. Better look inside the Apache FOP project where this has been integrated. Check the AFP extension section of http://xmlgraphics.apache.org/fop/trunk/output.html

    The examples in there are almost complete but here is a small XSL:FO input:

    <?xml version="1.0" encoding="UTF-8"?>
    <fo:root
        xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp"
        xmlns:fo="http://www.w3.org/1999/XSL/Format"
        >
    <fo:layout-master-set>
        <fo:simple-page-master master-name="Front" page-height="297mm" page-width="210mm"
                               margin-top="1mm" margin-bottom="1mm" margin-right="1mm"
                               margin-left="1mm">
            <fo:region-body region-name="Body_front"/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    
    <fo:declarations>
        <afp:include-form-map name="F1IDOCS1" src="file:src/test/data/afp/resources/F1IDOCS1.FDF"/>
    </fo:declarations>
    
    <fo:page-sequence master-reference="Front">
        <afp:invoke-medium-map name="DEFS"/>
        <fo:flow flow-name="Body_front">
    <fo:block-container>
    <fo:block font-family="Arial" font-size="12pt">Hello World !</fo:block>
    </fo:block-container>
    </fo:flow>
    </fo:page-sequence>
    </fo:root>