mPDF Manual – Getting Started

Creating your first file

The following PHP will produce the most basic example with mPDF ≥ 7.0.

// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';
// Create an instance of the class:
$mpdf = new \Mpdf\Mpdf();

// Write some HTML code:
$mpdf->WriteHTML('Hello World');

// Output a PDF file directly to the browser

Note: For mPDF < 7.0 use $mpdf = new \mPDF();


For details and options for the Output() method, see  Output().

Fork me on GitHub