Differing layouts with single and multi page documents

View: New views
2 Messages — Rating Filter:   Alert me  

Differing layouts with single and multi page documents

by ollie.petch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm using Apache FOP in a Java application to generate invoices, I want a footer displayed only on the final page of the invoice. Sometimes the invoices will span across multiple pages other times they will fill just a single page. After googeling extensively I have come up with the following:

<fo:layout-master-set>
  <fo:simple-page-master master-name="normal" >
    <fo:region-body />
      <fo:region-before />
  </fo:simple-page-master>
 
  <fo:simple-page-master master-name="last">
    <fo:region-body />
    <fo:region-before />
    <fo:region-after region-name="footer" />
  </fo:simple-page-master>

  <fo:page-sequence-master master-name="document">
    <!-- Single Page Layout -->
    <fo:repeatable-page-master-alternatives maximum-repeats="1">
      <fo:conditional-page-master-reference master-reference="last" page-position="first" />
    </fo:repeatable-page-master-alternatives>
   
    <!-- Multi Page Layout -->
    <fo:repeatable-page-master-alternatives maximum-repeats="no-limit">
      <fo:conditional-page-master-reference master-reference="normal" page-position="first" />
      <fo:conditional-page-master-reference master-reference="last" page-position="last" />
      <fo:conditional-page-master-reference master-reference="normal" page-position="rest" />
    </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>
</fo:layout-master-set>

From my understanding of what I have read online because I have set maximum-repeats to 1 on the first subsequence it will be ignored for all documents with more than one page,  therefore the next subsequence with maximum-repeats set to no-limit will be used. However with this setup I get the footers on the first page and the last page, but not on pages in-between. Is there something I am overlooking, to me it seems as though the maximum-repeats attribute is being ignored.

Any help would be appreciated,
Thanks
Ollie.

Re: Differing layouts with single and multi page documents

by ollie.petch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


ollie.petch wrote:
I'm using Apache FOP in a Java application to generate invoices, I want a footer displayed only on the final page of the invoice. Sometimes the invoices will span across multiple pages other times they will fill just a single page. After googeling extensively I have come up with the following:

<fo:layout-master-set>
  <fo:simple-page-master master-name="normal" >
    <fo:region-body />
      <fo:region-before />
  </fo:simple-page-master>
 
  <fo:simple-page-master master-name="last">
    <fo:region-body />
    <fo:region-before />
    <fo:region-after region-name="footer" />
  </fo:simple-page-master>

  <fo:page-sequence-master master-name="document">
    <!-- Single Page Layout -->
    <fo:repeatable-page-master-alternatives maximum-repeats="1">
      <fo:conditional-page-master-reference master-reference="last" page-position="first" />
    </fo:repeatable-page-master-alternatives>
   
    <!-- Multi Page Layout -->
    <fo:repeatable-page-master-alternatives maximum-repeats="no-limit">
      <fo:conditional-page-master-reference master-reference="normal" page-position="first" />
      <fo:conditional-page-master-reference master-reference="last" page-position="last" />
      <fo:conditional-page-master-reference master-reference="normal" page-position="rest" />
    </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>
</fo:layout-master-set>

From my understanding of what I have read online because I have set maximum-repeats to 1 on the first subsequence it will be ignored for all documents with more than one page,  therefore the next subsequence with maximum-repeats set to no-limit will be used. However with this setup I get the footers on the first page and the last page, but not on pages in-between. Is there something I am overlooking, to me it seems as though the maximum-repeats attribute is being ignored.

Any help would be appreciated,
Thanks
Ollie.
I'd like to add I get the exact same output when removing the maximum-repeats="1" attribute.

Ollie