FPDF Output Methods for PDF Files in PHP

FPDF is a PHP class which allows you to generate PDF files with purePHP, 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:
$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!):
$pdf->Output('directory/yourfilename.pdf','F');
    • Method 2: Prompting user to choose where to save the PDF file:
$pdf->Output('yourfilename.pdf','D');
    • Method 3: Automatically open PDF in your browser after being generated:
$pdf->Output('yourfilename.pdf','I');
    • Method 4: Returning the PDF file content as a string:
$pdf->Output('', 'S');

 

 

source: https://phpexcel.codeplex.com/discussions/227620


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *