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:

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

$mpdf = new mPDF();	 
$mpdf->WriteHTML('Your first taste of creating PDF from HTML');

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('HTML content goes here...', 2);

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:


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


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


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


Reference :

mPDF: HTML to PDF introduction