0

I am using using FPDF to create pdf file. But it show extension as php not pdf. When i download the file in mobile it show .php file. Now how can I convert the php extension to pdf

Here index.php file

 <a href="pdf.php">Click Here</a>

Here pdf.php file

 <?php
 require ("fpdf/fpdf.php");
 $name = "Amit Samadder";
 $pdf = new FPDF('p','mm','A4');
 $pdf->AddPage();
 $pdf->SetFont("Arial","B","20");
 $pdf->Cell(100,10, $name, 1,0, "C");
 $pdf->Output();
?>
A.S.Abir
  • 93
  • 7

1 Answers1

0

Have a look at http://fpdf.org/en/doc/output.htm

You need to change this line:

$pdf->Output();

To:

$pdf->Output('D', 'myfile.pdf');
Chris
  • 4,672
  • 13
  • 52
  • 93