MPDF-从第一张纸上的第10页开始的页码编号 [英] MPDF - Start page numbering from number 10 on the first sheet

查看:131
本文介绍了MPDF-从第一张纸上的第10页开始的页码编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,需要使用MPDF类打印文档,但是必须从43、44、45等开始页数.

I have an application and need to print a document using the MPDF class, however necessary that the number of page start at number 43, 44, 45 and so on.

而不是从1,2,3 ...

And not from the 1, 2, 3 ...

我设法从43开始,但是只跳了一片叶子.我无法插入分页符.

I managed to start from the 43 but only jumping a leaf. I can not insert a pagebreak.

谢谢.

下面是我的代码.

$mpdf = new mPDF();

$mpdf->setFooter("{PAGENO}");

$numero_paginas = "{nb}";

$mpdf->SetHTMLHeader('
<table>
    <tr>
        <td>
            <img src="img/cabecalho.png" />
        </td>
    </tr>
</table>
<hr>
');

$mpdf->SetHTMLFooter('');

$mpdf->WriteHTML('

<style type="text/css">
body{
    font-family:Arial, Times New Roman, sans-serif;
    font-size:10px;
}
</style>

' . $corpo_documento . '');

$mpdf->Output();
exit;

推荐答案

来自 mPDF手册在页码上:

如果要从第一页开始设置页码特征,则应使用AddPage()显式添加文档的第一页.请注意,通常不需要这样做,因为在首次使用WriteHTML()时,如果需要,mPDF会自动创建一个新的首页.

If you want to set page numbering characteristics from the first page onwards, you should explicitly add the first page of the document using AddPage(). Note that this is normally not required, as mPDF creates a new first page automatically if required when first using WriteHTML().

因此,在像这样设置页脚后调用AddPage():

So, call AddPage() after setting the footer like this:

$mpdf = new mPDF();
$mpdf->setFooter('{PAGENO}');
$mpdf->AddPage('', '', 43);

这篇关于MPDF-从第一张纸上的第10页开始的页码编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆