mPDF Manual – Getting Started

Creating your first file

Getting started

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

// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';

Create an instance of the class:

$mpdf = new mPDF();

// Write some HTML code:

$mpdf->WriteHTML('Hello World');

// Output a PDF file directly to the browser


For details and options for the Output command, see Output()