MPDF - Start pagination with variable numbering

3

I have an application and need to print a document using the mPDF class, however, I need the in pagination if you start, for example from the number 43 , 44 , 45 and so on and not from 1 , 2 , 3 , as is your default. I would like the pagination to start from a $numero_inicial variable. I've been able to start from any number, but just jumping a sheet through pagebreak and resetnumpage , however I can not skip a page and leave a blank sheet.

Below is my code.

$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;
    
asked by anonymous 07.11.2016 / 21:35

1 answer

1

Add 2 lines:

$numero_inicial = 43;
$mpdf->AddPage('', '', $numero_inicial);

where the value of the $numero_inicial variable would be the start of your pagination.

Full Code:

$mpdf = new mPDF();
$numero_inicial = 43;
$mpdf->AddPage('', '', $numero_inicial); // definindo o número que inicia a página
$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();

References:

09.11.2016 / 19:05