首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法生成静态第二页- fop

无法生成静态第二页- fop
EN

Stack Overflow用户
提问于 2017-11-22 16:12:54
回答 1查看 214关注 0票数 4

我正在尝试使用FOP生成PDF。

我的要求是-

第1页-标题和内容

第2页-术语的静态页面

第3页-第1页溢出

但是,当页面1没有溢出时,不会生成页面2。我希望生成第二个页面,即使第一页没有溢出。而且,我对第二页有不同的布局。

下面是带有布局集的fo文件-

代码语言:javascript
复制
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
         xmlns:th="http://www.thymeleaf.org">
    <fo:layout-master-set>
        <!-- layout for the first page -->
        <fo:simple-page-master master-name="first"
                               th:attr="page-width=${dimensions.width} + 'in',page-height=${dimensions.height} + 'in',margin-right=${rightMargin} + 'in',margin-left=${leftMargin} + 'in'"
                               margin-top="0pt" margin-bottom="1in">
            <fo:region-body region-name="xsl-region-body" margin-top="3.3in" margin-bottom="0.375in"/>
            <fo:region-before region-name="stmt-header" margin-top="0.5in"/>
            <fo:region-after region-name="stmt-footer"/>
        </fo:simple-page-master>

        <!-- layout for the other pages -->
        <fo:simple-page-master master-name="rest"
                               th:attr="page-width=${dimensions.width} + 'in',page-height=${dimensions.height} + 'in',margin-right=${rightMargin} + 'in',margin-left=${leftMargin} + 'in'"
                               margin-top="0pt" margin-bottom="1in">
            <fo:region-body margin-bottom="0.375in" margin-top="1in"/>
            <fo:region-before region-name="stmt-header-1" margin-top="0.5in"/>
            <fo:region-after region-name="stmt-footer"/>
        </fo:simple-page-master>

        <!-- layout for the other pages -->
        <fo:simple-page-master master-name="terms"
                               th:attr="page-width=${dimensions.width} + 'in',page-height=${dimensions.height} + 'in',margin-right=${rightMargin} + 'in',margin-left=${leftMargin} + 'in'"
                               margin-top="0pt" margin-bottom="1in">
            <fo:region-body margin-top="10in" margin-bottom="0.1in"/>
            <fo:region-before region-name="stmt-terms" margin-top="0.5in"/>
            <fo:region-after region-name="stmt-footer-1"/>
        </fo:simple-page-master>

        <fo:page-sequence-master master-name="Statement">
            <!--<fo:repeatable-page-master-alternatives>-->
                <!--<fo:conditional-page-master-reference master-reference="first" page-position="first"/>-->
                <!--<fo:conditional-page-master-reference master-reference="terms" page-position="only"/>-->
                <!--<fo:conditional-page-master-reference master-reference="rest" page-position="rest"/>-->
            <!--</fo:repeatable-page-master-alternatives>-->
            <fo:single-page-master-reference master-reference="first"/>
            <fo:single-page-master-reference master-reference="terms"/>
            <fo:repeatable-page-master-alternatives>
                <fo:conditional-page-master-reference master-reference="rest" page-position="rest"/>
            </fo:repeatable-page-master-alternatives>
        </fo:page-sequence-master>

    </fo:layout-master-set>
    <!-- end: defines page layout -->

    <!-- actual layout -->
    <fo:page-sequence master-reference="Statement" id="stmt">

        <fo:static-content flow-name="stmt-header">
            <th:block th:include="header-logo :: header-logo"/>
        </fo:static-content>

        <fo:static-content flow-name="stmt-header-1">
            <th:block th:include="header-logo :: header-logo-1"/>
        </fo:static-content>

        <fo:static-content th:with="footer_margin_left=1.7" flow-name="stmt-footer">
            <th:block th:include="footer"/>
        </fo:static-content>

        <fo:static-content th:with="footer_margin_left=0" flow-name="stmt-footer-1">
            <th:block th:include="footer"/>
        </fo:static-content>

        <fo:static-content flow-name="stmt-terms">
            <th:block th:include="stmt_terms :: stmt-terms"/>
        </fo:static-content>

        <fo:flow flow-name="xsl-region-body">
            <th:block th:include="${templateLayoutContent} :: stmt-body"/>
        </fo:flow>



    </fo:page-sequence>

</fo:root>

有人能帮帮我吗?

EN

回答 1

Stack Overflow用户

发布于 2017-11-22 16:54:16

我认为你正在寻找这个:force-page-count="even"这可以确保你的页面序列总是有偶数的页面。事实上,那就必须有第二页。如果页面上没有内容,您可以通过conditional- page -master的blank-or-not-blank属性指定使用的页面母版和静态内容。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47429701

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档