Suppose your script is working inside htdocs/test folder
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?php define('FPDF_FONTPATH','font/'); require('fpdf.php'); $mypdf=new FPDF(); $mypdf->Open(); $mypdf->AddPage(); $mypdf->SetFont('Arial','B',16); $mypdf->Cell(40,10,'Vasanthanpv@gmail.com'); $dir='C:/xampp/htdocs/test/'; $filename= "vasanthan.pdf"; $mypdf ->Output($dir.$filename) ?> |
above script will create pdf “vasanthan.pdf” and save into the folder htdocs/test.
below script will work in a different way it will show a popup window that shows openfile and save file button
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php define('FPDF_FONTPATH','font/'); require('fpdf.php'); $mypdf=new FPDF(); $mypdf->Open(); $mypdf->AddPage(); $mypdf->SetFont('Arial','B',16); $mypdf->Cell(40,10,'Vasanthanpv@gmail.com'); $filename="vasanthan"; $mypdf->Output($filename.'.pdf','F'); ?> |