Last block in flow body at the bottom on last page

ぐ巨炮叔叔 提交于 2021-01-27 23:36:32

问题


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-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



回答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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!