User composer to install mpdf composer require mpdf/mpdf
<?php require_once __DIR__ . '/vendor/autoload.php'; $mpdf = new \Mpdf\Mpdf(); $mpdf->WriteHTML('<h1>Hello world!</h1>'); $mpdf->Output('MyPDF.pdf', 'D'); ?>