I am working on a PHP project. I need to generate the PDF using the FPDF library, http://www.fpdf.org/ in my application. But I am having an issue with embedding the logo image in the header for every page.
Here is my code:
$fontFamily = "Helvetica";
$pdf = new Fpdi();
$pdf->SetFont($fontFamily,'',8);
$pdf->AliasNbPages();
$pdf->AddPage();
//logo at the top of the page.
$pdf->Image('img/logo.png', 125, 10, 73, 15);
//loop through the array and render the list
for($i=1;$i<=100;$i++)
$pdf->Cell(0,5,'Printing line number '.$i,0,1);
$pdf->Output();
As you can see in my code, I render the logo in the header following the example in the documentation. That adds the logo in the beginning of the PDF. But there is an issue with that. As you can see, I am looping through the array and rendering the list in the PDF. I don't know how long it is going to be since the data is going to be dynamic.
But it automatically creates new page for the list if needed. But the thing is the newly created page (second) page does not have the header logo at the top. How can I embed the logo in the header for the every page and it will be automatically added for the new pages?