1

我正在使用 ColdFusion 生成 PDF,<cfdocument>我只想在最后一页上显示页脚。我在这里找到了一个很好的解决方案,它只会在最后一页显示页脚。

如果您的页脚很长,您需要在<cfdocument>标签中添加 marginbottom 以定义空间,例如:

<cfdocument format="PDF" unit="in" marginbottom="1.5" ... >

这意味着每一页的底部都会有 1.5 英寸的空白空间,有没有办法只将该空间应用于最后一页?

4

1 回答 1

0

我没有对此进行测试,但它可能会起作用。使用<cfdocumentsection>标签来定义<cfdocument>代码块的特定区域。<cfdocumentsection>还允许您仅为该部分指定 marginBottom。

根据文档

将 PDF 或 FlashPaper 文档分成多个部分。通过将此标记与标记结合使用cfdocumentitem,每个部分都可以具有唯一的页眉、页脚和页码。

尝试这样的事情:

<cfdocument format="PDF" unit="in" ... >
    <cfdocumentsection>
        <!--- All of your existing logic here --->
    </cfdocumentsection>
    <cfdocumentsection marginbottom="1.5"> 
        <cfdocumentitem type="footer" evalAtPrint="true">
            <cfif cfdocument.currentPageNumber eq cfdocument.totalPageCount>
                This is the last page footer
            </cfif>
        </cfdocumentitem>
    </cfdocumentsection>
</cfdocument>
于 2014-08-12T17:57:26.763 回答