xsl-foapache-fop

Add additional text pages in XSL FO (FOP) without header


I can't solve one problem. I need to add a few more pages to the end of the document in XSL FO (in FOP), but without headers and footers.

I will print the invoice. I have one simple-page-master defined for the first page and another simple-page-master for all other pages. So far it's been trouble free.

However, I need to optionally print additional pages where there will be terms and conditions, a simple long text that will again be several pages, but I don't want any header on these pages and I need the text to start right at the top of those pages.

I have absolutely no idea how to create an additional (third) simple-page-master where I would not have any header defined, or rather I don't know how to call it just for the terms and conditions pages :(

I hope I wrote it clearly. Can someone help please? Thank you very much.

For example:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="first-page" margin="1in">
      <fo:region-body margin-top="15mm"/>        
      <fo:region-before extent="10mm" region-name="xsl-region-before-first-page"/>
    </fo:simple-page-master>
    <fo:simple-page-master master-name="other-pages" margin="1in">
      <fo:region-body margin-top="15mm"/>        
      <fo:region-before extent="10mm" region-name="xsl-region-before-other-pages"/>
    </fo:simple-page-master>   
    <fo:page-sequence-master master-name="main-master">
      <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference master-reference="first-page" page-position="first"/>
        <fo:conditional-page-master-reference master-reference="other-pages"/>          
      </fo:repeatable-page-master-alternatives>        
    </fo:page-sequence-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="main-master">
    <fo:static-content flow-name="xsl-region-before-first-page">
      <fo:block font-size="36pt" background-color="#ff0000">Header for the first page</fo:block>
    </fo:static-content>
    <fo:static-content flow-name="xsl-region-before-other-pages">
      <fo:block font-size="36pt" background-color="#0000ff">Header for other pages</fo:block>
    </fo:static-content>
    <fo:flow flow-name="xsl-region-body">
      <!-- rows of document -->
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>
      <fo:block font-size="36pt">Row of document</fo:block>

      <!-- add some pages with texts -->
      <fo:block page-break-before="always" />
      <fo:block font-size="36pt">Some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text, some other text</fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

And here is PDF:

document-with-headers.pdf

All I need is, that on pages, where "Some other text, some other text ..." is, will not be a header :(


Solution

  • Make a new fo:page-sequence for "Some other text, some other text ...".

    Do not have any fo:static-content in the new fo:page-sequence so there's nothing that can be directed to the outer regions of the pages.

    If you want different margins for those pages, create a new fo:simple-page-master (or new fo:page-sequence-master and the fo:simple-page-masters that it would use) and have the master-reference of the new fo:page-sequence refer to that.

    The new fo:simple-page-master(s) that you create just need an fo:region-body with the correct margins. There's no need for fo:region-before, etc., as there's no headers on those pages.