我可以创建 PDF 没问题,但需要 PDF 的页码从某个页面开始——而不是 1。通常我会使用 cfdocument 范围来显示页码,但因为我不想要页面从 1 开始的数字 我无法让代码工作。不确定如何在增加每一页时最好地做到这一点。这是运行良好的代码:
<cfset theStartPageNumber = 10 />
<cfdocument format="PDF>
<cfoutput query="getPerson">
<cfdocumentsection>
<cfdocumentitem type="header">
<table>
<tr>
<td>My Header</td>
</tr>
</table>
</cfdocumentitem>
#getPerson.FirstName# #getPerson.LastName#
<cfdocumentitem type="footer" evalAtPrint="true" pageNumber="#theStartPageNumber#">
<table>
<tr>
<td align="center"><cfoutput>#attributes.pageNumber#</cfoutput></td>
</tr>
</table>
</cfdocumentitem>
</cfdocumentsection>
<cfset thePageNumber ++ />
</cfoutput>
</cfdocument>
但是当我引入分页符时,编号不会增加每一页。这是不增加每个页码的代码。
<cfset theStartPageNumber = 10 />
<cfdocument format="PDF>
<cfoutput query="getPerson">
<cfdocumentsection>
<cfdocumentitem type="header">
<table>
<tr>
<td>My Header</td>
</tr>
</table>
</cfdocumentitem>
#getPerson.FirstName# #getPerson.LastName#
<cfdocumentitem type="pagebreak" />
#getPerson.Address#
<cfdocumentitem type="pagebreak" />
<cfdocumentitem type="footer" evalAtPrint="true" pageNumber="#theStartPageNumber#">
<table>
<tr>
<td align="center"><cfoutput>#attributes.pageNumber#</cfoutput></td>
</tr>
</table>
</cfdocumentitem>
</cfdocumentsection>
<cfset thePageNumber ++ />
</cfoutput>
</cfdocument>
使用不起作用的代码,页码将保持“10”两页,然后增加到“11”。
任何帮助表示赞赏!