2

How can I have the last fo:block in fo:flow body aligned at the bottom of the last page?

I do not mean footer section on each page, it is ok, but I want to have the last block in flow body at the bottom on last page.

The content of flow body is diverse and I do not know, what will be the height of this last block section.

Is it possible to do somehow?

lfurini
  • 3,729
  • 4
  • 30
  • 48
Jirin
  • 31
  • 4
  • Another possible solution from [an answer to a similar question](https://stackoverflow.com/a/18020403/4453460): use a *footnote*. – lfurini Mar 24 '19 at 13:10

2 Answers2

1

If you are using AH Formatter, you could make the last block float to the bottom of the page.


You may be able to put the last block inside an fo:block-container and absolutely position the fo:block-container at the bottom of the page.


You can put the last block in a footer that appears only on the last page:

  • Make a separate fo:simple-page-master just for the last page
  • Use an fo:region-after with a difference master-name value on that page
  • Specify display-align="after" on the fo:region-after to make sure that its content appears at the bottom
  • In your fo:page-sequence-master, use an fo:repeatable-page-master-alternatives that includes an fo:conditional-page-master-reference early in the alternatives that has page-position="last" and that selects your page master for the last page
  • In the fo:page-sequence, make an fo:static-content with a master-reference that matches the flow-name of the xsl:region-after of the fo:simple-page-master for the last page
  • Put the last block content in that fo:static-content
Tony Graham
  • 7,306
  • 13
  • 20
  • Thanx, but something is wrong (sure my code) :) Is it probel I'm using Ibex PDF Creator? – Jirin Mar 23 '19 at 13:55
  • Please update the question to include a minimal sample of your code that shows the problem. So far, between @Ifurini and me, you've got five possible solutions to your problem. – Tony Graham Mar 24 '19 at 14:49
  • My code is here (I can't insert it right here - too long): http://www.xmlgen.cz/tmp/last-block-bottom-last-page.fo Thanx – Jirin Mar 24 '19 at 21:17
1

A simple trick that should work (I successfully tested it with FOP 2.3):

<fo:block keep-with-previous.within-page="always" 
    keep-together.within-page="always"
    space-before.minimum="1cm" 
    space-before.optimum="30cm" 
    space-before.maximum="30cm">
    Text at the end of the last page
</fo:block>
  • this block will be placed in the last page, together with (at least a piece of) the preceding block
  • it will not be split between pages even if it contains a lot of text, or other blocks (many thanks to user joH1 for this suggestion)
  • the optimal space between it and the previous line is greater than the body region height, but the minimum space is much smaller, so it can be "squeezed" (you may want to adjust the minimum value according to your preferences)
  • the result is that the formatter will place the whole last block in the page as far as possible from the previous block, which is at the bottom of the body region
lfurini
  • 3,729
  • 4
  • 30
  • 48
  • 1
    One can add `keep-together.within-page="always"` if the block to put on the bottom has several nested blocks – joH1 Aug 24 '22 at 09:41
  • 1
    Sorry for bumping an old post, but I encountered the same issue and your trick worked, I just needed to add this attribute to make it perfect :) – joH1 Aug 24 '22 at 09:42