tags:

views:

236

answers:

1

Using apache FOP, want to create a header with a logo aligned left, three-line address aligned right, both aligned top.

Following works ok if done inside of flow, but in a static-content header ('xsl-region-before') it gets the left & right correct but aligns the logo below the address block, as if the table definition were being ignored completely.

I've tried other options, like trying to inline the two, or use floats, with similar results. The header just treats them like separate blocks and stacks them. Anyone have any suggestions?

I found this other issue asking the same question about footers, alas no replies: http://stackoverflow.com/questions/1214296/need-instream-foreign-object-and-text-to-both-align-to-the-bottom-in-xsl-fo

Relevant snippet follows:

    <fo:layout-master-set>
        <fo:simple-page-master page-height="8.5in" page-width="11in" master-name="only" margin=".5in .5in .5in .5in">
            <fo:region-body region-name="xsl-region-body" margin-top="1in" margin-bottom=".5in"/>
            <fo:region-before region-name="xsl-region-before"/>
            <fo:region-after region-name="xsl-region-after"/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="only">
        <fo:static-content flow-name="xsl-region-before">
                <fo:block font-size="7pt">
                    <fo:table width="10in">
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-body>
                            <fo:table-row>
                                <fo:table-cell>
                                    <fo:block>
                                        <fo:external-graphic src="img/print_logo.png" content-width="2in"/>
                                    </fo:block>
                                </fo:table-cell>
                                <fo:table-cell display-align="center">
                                    <fo:block text-align="right">
                                        123 Credibility Street
                                    </fo:block>
                                    <fo:block text-align="right">
                                        Chicago, IL  60606
                                    </fo:block>
                                    <fo:block text-align="right">
                                        312-123-4567
                                    </fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                        </fo:table-body>
                    </fo:table>
                </fo:block>
        </fo:static-content>
A: 

I managed to achieve the desired effect by putting the two elements in two separate block-containers with absolute positioning:

<fo:static-content flow-name="xsl-region-before">
    <fo:block-container position="absolute">
        <fo:block>
            <fo:external-graphic src="img/print_logo.png" content-width="2in"/>
        </fo:block>
    </fo:block-container>
    <fo:block-container position="absolute">
        <fo:block text-align="right">
            123 Credibility Street
        </fo:block>
        <fo:block text-align="right">
            Chicago, IL  60606
        </fo:block>
        <fo:block text-align="right">
            312-123-4567
        </fo:block>
    </fo:block-container>
</fo:static-content>
Tim F