我使用<cfdocument>
在ColdFusion中生成PDF,我只想在最后一页显示页脚。我找到了一个很好的解决方案here,并且只会在最后一页显示页脚。
如果您的页脚很长,则需要在<cfdocument>
标记中添加marginbottom以定义空格,例如:
<cfdocument format="PDF" unit="in" marginbottom="1.5" ... >
这意味着每个页面的底部都有1.5英寸的空白区域,有没有办法只将该空间应用到最后一页?
答案 0 :(得分: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>