Dude, when a doubt like that comes up go straight to documentation.
The mpdf setHeader does not do what you want (iterate over a list of users and print a custom header for each). What you should do is set a different header for each page.
Example based on the latest version of mpdf (taken from there):
<?php
// First ensure that you are on an Even page
$mpdf->AddPage('','E');
// Then set the headers for the next page before you add the page
$mpdf->SetHTMLHeader('<div style="text-align: right; border-bottom: 1px solid #000000; font-weight: bold; font-size: 10pt;">Chapter 2</div>','O');
$mpdf->SetHTMLHeader('<div style="border-bottom: 1px solid #000000; font-weight: bold; font-size: 10pt;">Chapter 2</div>','E');
$mpdf->AddPage();
$mpdf->SetHTMLFooter('<div style="text-align: right; font-weight: bold; font-size: 8pt; font-style: italic;">Chapter 2</div>','O');
$mpdf->SetHTMLFooter('<div style="font-weight: bold; font-size: 8pt; font-style: italic;">Chapter 2</div>','E');
$mpdf->WriteHTML('Rest of the document');
$mpdf->Output();
Basically you will scroll through your $html array, and for each index (or user) add a new page with a custom header.
printa o html se ele tiver sair o ultimo usuario o problema é o setHeader e sim o seu html
– Gabriel Rodrigues
not that the problem because the function is returned a user list, problem is at the time of generating pdf, the API is not making a loop for each user data by placing a header.
– Humberto Lopes
Wouldn’t it be better to use the fpdf, at least have a manual for that reason.
– Ivan Ferrer