Question

I am working on a duplex document which needs a front page (with an image eg. 'Letterhead.jpg'), a backer for that page (with a backer image eg' Backer.jpg'), and if information for that front page flows over the page boundaries, it flows into a 'continuation' page (with image 'continuation'). This continuation page also requires the same 'continuation.jpg' image on the back, with information then flowing onto that reverse page.

I am having issues with setting this up correctly. I currently have my primary page working fine, but from there its not formatting as i'd wish. If the primary page has no overflow, then the reverse is pulling the continuation graphic by default. And then when there is an overflow, the data flows onto the backer (with continuation graphic), and then any subsequent pages.

Im sorry if this post confuses, and im not explaining very well, im summary, what I need is:

Primary Page: flow data with letterhead.jpg graphic.

Reverse of primary page: no data to flow onto here. only backer.jpg graphic. (if flow data from Primary page overflows page boundaries then..)

Continuation Page: continuation of flow data from primary, with continuation.jpg graphic.

Reverse of Continuation Page: continuation of flow data from Continuation Page, with continuation.jpg graphic.

End Page: A blank page to go at the end.

Here is my current code:

 <fo:layout-master-set>
    <fo:page-sequence-master master-name="document">
        <fo:repeatable-page-master-alternatives>
              <fo:conditional-page-master-reference master-reference="continuation-even" page-position="first" odd-or-even="even"/>
              <fo:conditional-page-master-reference master-reference="letter" page-position="first"/>
              <fo:conditional-page-master-reference master-reference="continuation-odd" odd-or-even="odd"/>
              <fo:conditional-page-master-reference master-reference="continuation-rest" odd-or-even="even"/>
              <fo:conditional-page-master-reference master-reference="last" page-position="last" odd-or-even="even"/>
        </fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>      
<fo:simple-page-master master-name="letter" page-height="32.0cm" page-width="22.5cm" margin-top="1.15cm" margin-bottom="2.15cm" margin-left="0.75cm" margin-right="0.75cm">
    <fo:region-body margin-top="10.3cm" margin-bottom="2cm" margin-left="1.6cm" margin-right="2.5cm" />
        <fo:region-before region-name="letterhead graphic" extent="29.7cm"/>
                    </fo:simple-page-master>
                    <fo:simple-page-master master-name="continuation-odd" page-height="32.0cm" page-width="22.5cm" >
                        <fo:region-body margin-top="4.5cm" margin-bottom="1.8cm" margin-left="2.3cm" margin-right="2.0cm" />
                        <fo:region-before region-name="continuation graphic" extent="29.7cm"/>
                    </fo:simple-page-master>
                    <fo:simple-page-master master-name="continuation-even" page-height="32.0cm" page-width="22.5cm" >
                        <fo:region-body margin-top="32.0cm" margin-bottom="0cm" margin-left="2.5cm" margin-right="2.0cm" />
                            <fo:region-before region-name="backer" extent="29.7cm"/>
                    </fo:simple-page-master>
                    <fo:simple-page-master master-name="continuation-rest" page-height="32.0cm" page-width="22.5cm" >
                        <fo:region-body margin-top="4.5cm" margin-bottom="1.8cm" margin-left="2.3cm" margin-right="2.0cm" />
                        <fo:region-before region-name="continuation graphic" extent="29.7cm"/>
                    </fo:simple-page-master>
                    <fo:simple-page-master master-name="last" page-height="32.0cm" page-width="22.5cm" >
                        <fo:region-body margin-top="0.5cm" margin-bottom="0.5cm" margin-left="0.5cm" margin-right="2.0cm" />
                        <fo:region-before region-name="end-page" extent="29.7cm"/>
                    </fo:simple-page-master>
                    <fo:simple-page-master master-name="separator" page-height="32.0cm" page-width="22.5cm" margin-top="2.15cm" margin-bottom="1.15cm" margin-left="1.75cm" margin-right="0.75cm">
            <fo:region-body/>
    </fo:simple-page-master>
</fo:layout-master-set>
Was it helpful?

Solution

THATS IT!

going through what you mentioned and what you added your original question solved the problem.

Here is the code we have now put together which does exactly what we need.

<xsl:template match="/">
    <fo:root>
        <fo:layout-master-set>
            <fo:page-sequence-master master-name="document">
                <fo:repeatable-page-master-alternatives maximum-repeats="2">
                    <fo:conditional-page-master-reference master-reference="front" odd-or-even="odd"/>
                    <fo:conditional-page-master-reference master-reference="back-special" odd-or-even="even"/>
                </fo:repeatable-page-master-alternatives>
                <fo:repeatable-page-master-alternatives>
                    <fo:conditional-page-master-reference master-reference="front" odd-or-even="odd"/>
                    <fo:conditional-page-master-reference master-reference="back" odd-or-even="even"/>
                </fo:repeatable-page-master-alternatives>
            </fo:page-sequence-master>
            <fo:simple-page-master master-name="front" page-height="29.7cm" page-width="21.0cm" margin-top="5cm" margin-bottom="5cm" margin-left="2.5cm" margin-right="2.5cm">
                <fo:region-body/>
            </fo:simple-page-master>
            <fo:simple-page-master master-name="back" page-height="29.7cm" page-width="21.0cm" margin-top="5cm" margin-bottom="5cm" margin-left="2.5cm" margin-right="2.5cm">
                <fo:region-body/>
            </fo:simple-page-master>
            <fo:simple-page-master master-name="back-special" page-height="29.7cm" page-width="21.0cm" margin-top="5cm" margin-bottom="25cm" margin-left="2.5cm" margin-right="2.5cm">
                <fo:region-body/>
                <fo:region-before region-name="special" extent="29.7cm"/>
            </fo:simple-page-master>
        </fo:layout-master-set> 

        <fo:page-sequence master-reference="document">
            <fo:static-content flow-name="special">
                <fo:block>
                    <fo:external-graphic src="url('special.jpg')"/>
                </fo:block>
            </fo:static-content>

            <fo:flow flow-name="xsl-region-body" font-family="Helvetica" font-size="14pt">
                <fo:block>
                    <xsl:for-each select="/data/item">
                        <fo:block space-after="2cm"><xsl:value-of select="."/></fo:block>
                    </xsl:for-each>
                </fo:block>
            </fo:flow>
        </fo:page-sequence>
    </fo:root>
</xsl:template>

Thanks for your help!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top