分页编号在mpdf中无法正确显示

I am using codeigniter and I have a long view that I need a pagination but it didn't work properly. I tried to apply this example: https://mpdf.github.io/paging/page-numbering.html but ended up with a blank page as page 1?

$pdfdata = $this->load->view('pdf/pdffile', $data, true);
$pdf2 = $this->m_pdf->load();

$pdfFilePath2 = uniqid(rand(), true);
$pdfFilePath_2 = "pdffile-".date('Ymdhis')."-".$pdfFilePath2.".pdf";

$pdf2->setHeader('{PAGENO}');
$mpdf->WriteHTML('<pagebreak resetpagenum="1" pagenumstyle="1" suppress="off" />');

$pdf2->WriteHTML($pdfdata);
$pdf2->Output("./uploads/".$pdfFilePath_2, "F");

I wanted the header have pagination like "1 of page N" but I dont get the example and always give me a plank page as page 1. any idea?

You are getting an empty first page because the first thing you are writing to mPDF is a page break.

Write some content before the pagebreak element to have content on the first page. Omit the pagebreak element if you really don't need it.

To display pagination you want, use

$pdf2->setHeader('{PAGENO} of {nbpg​}');