PHP 7 FPDF Example to Add Header & Footer Images in All Pages of PDF With Hyperlinks Inside Browser

Using this tutorial, we are going to run the script PHP 7 FPDF Example to Add Header & Footer Images in All Pages of PDF With Hyperlinks Inside Browser. Below you will find the possibilities for doing the task using this tutorial.

PHP 7 FPDF Example to Add Header & Footer Images in All Pages of PDF With Hyperlinks Inside Browser

PHP 7 FPDF Example to Add Header & Footer Images in All Pages of PDF With Hyperlinks Inside Browser

<?Php
require('fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->Image('images/pdf-header.jpg',0,0);
$pdf->Output();
?>
<?Php
require('fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->Image('images/pdf-header.jpg',20,60,180,20,'JPG','www.plus2net.com');
$pdf->Output();
?>

<?Php
require('fpdf.php');
 
class PDF extends FPDF
{
// Page header
function Header()
{
$this->Image('images/pdf-header.jpg',0,0);
}
// Page footer
function Footer()
{
$this->SetY(-20);
$this->Image('images/pdf-footer.jpg');
}
}
 
// Instanciation of inherited class
$pdf = new PDF();
$pdf->SetMargins(10,60,10);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
for($i=1;$i<=40;$i++)
    $pdf->Cell(0,10,'This is line number '.$i,0,1);
$pdf->Output();
?>

Final Words

I hope this article is a PHP 7 FPDF Example to Add Header & Footer Images in All Pages of PDF With Hyperlinks Inside Browser Let me know in the comments section if you have any issues.

Hi, I'm Selva a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment