MPDF:重置总页码
MPDF: Reset total page number
我需要一些建议。
我用 mpdf 创建 pdf。在同一个 pdf 中,我生成了多张发票。
我需要重置总页码。例如在同一个 PDF 中:
Invoice A 1 - 2
Invoice A 2 - 2
Invoice B 1 - 1
Invoice C 1 - 2
Invoice C 2 - 2
etc...
目前我用
解决了当前页码的重置问题
$pdf->AddPageByArray(array(resetpagenum => '1'));
但我找不到如何重置总页码。
当我打印 PDF 时,我得到
Invoice A 1 - 5
Invoice A 2 - 5
Invoice B 1 - 5
Invoice C 1 - 5
Invoice C 2 - 5
有什么想法吗?
您必须使用不同的别名来打印总页数。目前,您最有可能使用的是 alias {nb}
,它只打印总页数。
但还有 alias {nbpg}
打印 考虑页面组的总页数 。
的文档页面上对此进行了很好的描述
AliasNbPageGroups
– Defines the placeholder used to insert total page number of the page group or document into the document
Set the value for the variable string aliasNbPgGp
which is used as a placeholder used to insert total page number into the document. If you have reset the page numbering with AddPage()
or <pagebreak>
the total number of pages in the current page group will be used (up to where the numbering is reset) rather the total number of pages in the whole document.
我需要一些建议。 我用 mpdf 创建 pdf。在同一个 pdf 中,我生成了多张发票。 我需要重置总页码。例如在同一个 PDF 中:
Invoice A 1 - 2
Invoice A 2 - 2
Invoice B 1 - 1
Invoice C 1 - 2
Invoice C 2 - 2
etc...
目前我用
解决了当前页码的重置问题$pdf->AddPageByArray(array(resetpagenum => '1'));
但我找不到如何重置总页码。 当我打印 PDF 时,我得到
Invoice A 1 - 5
Invoice A 2 - 5
Invoice B 1 - 5
Invoice C 1 - 5
Invoice C 2 - 5
有什么想法吗?
您必须使用不同的别名来打印总页数。目前,您最有可能使用的是 alias {nb}
,它只打印总页数。
但还有 alias {nbpg}
打印 考虑页面组的总页数 。
AliasNbPageGroups
– Defines the placeholder used to insert total page number of the page group or document into the documentSet the value for the variable string
aliasNbPgGp
which is used as a placeholder used to insert total page number into the document. If you have reset the page numbering withAddPage()
or<pagebreak>
the total number of pages in the current page group will be used (up to where the numbering is reset) rather the total number of pages in the whole document.