mPDF : Your web based PDF report

Looking for report for your web based application? mPDF would be one of the good option to choosed.

mPDF Installation and setup
Download latest mPDF version from the official website. Extract zipped file content to your defined folder and rename it to mpdf for better usage.
You may also allow three catalogs to be written. Folders list:
/ttfontdata/
/tmp/
/graph_cache/

Initializing mPDF and a first try
You may try your first code as example bellow

require_once('library/mpdf.php'); 
$mpdf = new mPDF();	 
$mpdf->WriteHTML('Your first taste of creating PDF from HTML');
$mpdf->Output();
exit;

More complex usage
We are trying to parse only CSS contents from file and add some div to the file. View the example here:

$mpdf = new mPDF();
$stylesheet = file_get_contents('stylesheet.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML('HTML content goes here...', 2);
$mpdf->Output();
exit;

Specific Page Format

$mpdf = new mPDF('utf-8', 'A4');
$mpdf = new mPDF('utf-8', array(190,236));

Some output method provided by mPDF
Method 1: Saving the PDF to a file:

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

Method 2: Prompting user to choose where to save the PDF file:

$pdf->Output('filename.pdf','D');

Method 3: Automatically open PDF in your browser after being generated:

$pdf->Output('filename.pdf','I');

Method 4: Returning the PDF file content as a string:

$pdf->Output('','S');

Reference :

mPDF: HTML to PDF introduction


http://blog.startq.com/index.php/2011/10/25/fpdf-output-methods-for-pdf-files-in-php/