tuto2.php 732 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. require('../fpdf.php');
  3. class PDF extends FPDF
  4. {
  5. //Page header
  6. function Header()
  7. {
  8. //Logo
  9. $this->Image('logo_pb.png',10,8,33);
  10. //Arial bold 15
  11. $this->SetFont('Arial','B',15);
  12. //Move to the right
  13. $this->Cell(80);
  14. //Title
  15. $this->Cell(30,10,'Title',1,0,'C');
  16. //Line break
  17. $this->Ln(20);
  18. }
  19. //Page footer
  20. function Footer()
  21. {
  22. //Position at 1.5 cm from bottom
  23. $this->SetY(-15);
  24. //Arial italic 8
  25. $this->SetFont('Arial','I',8);
  26. //Page number
  27. $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  28. }
  29. }
  30. //Instanciation of inherited class
  31. $pdf=new PDF();
  32. $pdf->AliasNbPages();
  33. $pdf->AddPage();
  34. $pdf->SetFont('Times','',12);
  35. for($i=1;$i<=40;$i++)
  36. $pdf->Cell(0,10,'Printing line number '.$i,0,1);
  37. $pdf->Output();
  38. ?>