FPDF is a class to create PDF files with PHP, that is to say without using the PDFlib library.
For those who are already familiar with FPDF, this post will show you how to output your PDF file using FPDF. There are 4 methods that you can use according to your own needs:
Method 1: Saving the PDF to a file:
1 |
$pdf->Output('yourfilename.pdf','F'); |
Method 1 (for server): Saving the PDF file to server (make sure you have 777 writing permissions for that folder!):
1 |
$pdf->Output('directory/yourfilename.pdf','F'); |
Method 2: Prompting user to choose where to save the PDF file:
1 |
$pdf->Output('yourfilename.pdf','D'); |
Method 3: Automatically open PDF in your browser after being generated:
1 |
$pdf->Output('yourfilename.pdf','I'); |
Method 4: Returning the PDF file content as a string:
1 |
$pdf->Output('', 'S'); |