I have a PHP file "pdf.php" and it is not working. I checked with some tutorials and videos and just do not understand the mistake it has.
Any help/suggestion would be really appreciated
<?php
require('fpdf181/fpdf.php');
//defining pdf objectives
$pdf = new FPDF('p', 'mm', 'A4');
//Document properties
$pdf-> SetTitle('Auftrag Anbieterwechsel');
//SetFont
$pdf->SetFont('Helvetica','B',14);
$pdf->AddPage('P');
$pdf->SetDisplayMode('real','default');
$pdf->SetXY(50,20);
$pdf->SetDrawColor(50,60,100);
$pdf->Cell(100,10,'FPDF Tutorial',1,0,'C',0);
$pdf->SetXY(10,50);
$pdf->SetFontSize(10);
$pdf->Write(5,'Congratulations! You have generated a PDF. ');
$pdf->Output('MDDSL.pdf','I');
?>
The output is showing now "The page isn't working".
You have some mistakes in your code.
1 - $pdf = SetTitle('Something'); --> $pdf->SetTitle('Something');
2 - $pdf->SetDisplayMode(real,'default'); --> $pdf->SetDisplayMode('real','default'); //because real is a string value and needs quote
Also please make sure your path to fpdf.php is right. The code works for me otherwise.