Skip to content

Instantly share code, notes, and snippets.

@estefanionsantos
Created April 19, 2025 04:01
Show Gist options
  • Save estefanionsantos/50d83a8999fe208b813939dd1234b590 to your computer and use it in GitHub Desktop.
Save estefanionsantos/50d83a8999fe208b813939dd1234b590 to your computer and use it in GitHub Desktop.
fpdf-tuto2-1
<?php
use Rubricate\Fpdf\FileFpdf;
class PDF extends FileFpdf
{
public function header()
{
$this->image('logo.png',10,6,30);
$this->setFont('Arial','B',15);
$this->cell(80);
$this->cell(30,10,'Title',1,0,'C');
$this->ln(20);
}
public function footer()
{
$this->setY(-15);
$this->setFont('Arial','I',8);
$this->cell(0,10,'Page '.$this->pageNo().'/{nb}',0,0,'C');
}
}
$pdf = new PDF();
$pdf->aliasNbPages();
$pdf->addPage();
$pdf->setFont('Times','',12);
for($i=1;$i<=40;$i++){
$pdf->cell(0,10,'Printing line number '.$i,0,1);
}
$pdf->output();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment