Save PDF file in predefined path


#1

Guys I'm trying to save pdf file in pre-defined path, but it's not saving file in predefined path instead providing saveas option.

I'm using FPDF.

Below is my CODE

  $pdf=new FPDF();
    $pdf->AddPage();
    $pdf->SetFont('Arial','B',14);
    $txt = "Legal Document of Mr." .$result[0]['first_name'];
    $pdf->Cell(180,0,$txt,0,1,'C');
    $pdf->Line(5,20,200,20);
    $pdf->SetFont('Arial','',12);
    $content = "This is the AGREEMENT to purchase made by ".$result[0]['first_name'] ." from SriramProperties on day 7/12/2017,";
    $pdf->Cell(5,30,$content,0,0,'');
    $content = "is located at " . $result[0]['location']."and his dob is ".$result[0]['dob']." will be owner of the plot";
    $pdf->Cell(0,45,$content,0,0,'');
    header('Content-Type:application/pdf');
 		$filename="../pdf/pdfdocument.pdf"; //path im trying to save
	$pdf->Output($filename,'F');

Need solution for this..It's urgent


#2

If I'm reading the FPDF documentation correctly, then this line

$pdf->Output($filename,'F');

is incorrect, the first parameter should be the destination ("F" in your case) and the second parameter is the name. Note that the filename is a local filename.

http://www.fpdf.org/en/doc/output.htm


#3

Try setting error_reporting(-1); and ini_set('display_errors, 'true');

I think it may give an error stating the path permissions are incorrect.


#4

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.