问题
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?
回答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-masterjust for the last page - Use an
fo:region-afterwith a differencemaster-namevalue on that page - Specify
display-align="after"on thefo:region-afterto make sure that its content appears at the bottom - In your
fo:page-sequence-master, use anfo:repeatable-page-master-alternativesthat includes anfo:conditional-page-master-referenceearly in the alternatives that haspage-position="last"and that selects your page master for the last page - In the
fo:page-sequence, make anfo:static-contentwith amaster-referencethat matches theflow-nameof thexsl:region-afterof thefo:simple-page-masterfor the last page - Put the last block content in that
fo:static-content
回答2:
A simple trick that should work (I successfully tested it with FOP 2.3):
<fo:block keep-with-previous.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
- 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 last block in the page as far as possible from the previous block, which is at the bottom of the body region
来源:https://stackoverflow.com/questions/55269798/last-block-in-flow-body-at-the-bottom-on-last-page