require('../fpdf/fpdf.php'); class PDF extends FPDF { // Page header { // Logo $this -> Image('./../img/no-grey.svg', 10, 6, 30); // Arial bold 15 $this -> SetFont('Arial', 'B', 15); // Move to the right $this -> Cell(80); // Title $this -> Cell(30, 10, 'Title', 1, 0, 'C'); // Line break $this -> Ln(20); } // Page footer function Footer() { // Position at 1.5 cm from bottom $this -> SetY(-15); // Arial italic 8 $this -> SetFont('Arial', 'I', 8); // Page number $this -> Cell(0, 10, 'Page '.$this->PageNo().' / {nb}', 0, 0, 'C'); } } $pdf = new FPDF('P', 'mm', 'A4'); $pdf -> AddPage('P'); $pdf -> SetFont('Arial', 'B', 14); $pdf -> SetMargins(20, 20, 20); $pdf -> SetTitle($abstract['abstractTitle']); $pdf -> SetSubject($abstract['abstractTitle']); $pdf -> SetAuthor('X Konferencja Adeptów Fizjologii'); $pdf -> SetCreator('Skrypt FPDF wykonany dla X Konferencji Adeptów Fizjologii'); $pdf -> MultiCell(0, 5, 'Tekst, który zostanie wygenerowany za pomocą Biblioteki FPDF.', 0, 'J', 0); $x = $pdf -> GetX(); $y = $pdf -> GetY(); $pdf -> SetXY($x, $y + 10); $pdf -> MultiCell(0, 5, 'To już drugi text, który zostanie wygenerowany.', 0, 'J', 0); $pdf -> Footer(); $file = htmlspecialchars($abstract['abstractAuthor'])." - ".htmlspecialchars($abstract['abstractTitle']).".pdf"; $pdf -> Output('I', $file)
wywala
Fatal error: Uncaught exception 'Exception' with message 'FPDF error: Some data has already been output, can't send PDF file (output started at /home/smusic/ftp/_x-kaf/admin/abstracts.php:35)' in /home/smusic/ftp/_x-kaf/fpdf/fpdf.php:271 Stack trace: #0 /home/smusic/ftp/_x-kaf/fpdf/fpdf.php(1052): FPDF->Error('Some data has a...') #1 /home/smusic/ftp/_x-kaf/fpdf/fpdf.php(999): FPDF->_checkoutput() #2 /home/smusic/ftp/_x-kaf/php/abstracts.php(106): FPDF->Output('I', 'Hainz von Klops...') #3 /home/smusic/ftp/_x-kaf/admin/abstracts.php(103): include('/home/smusic/ft...') #4 {main} thrown in /home/smusic/ftp/_x-kaf/fpdf/fpdf.php on line 271