I got this error using MPDF to create a pdf file in drupal 8:

Mpdf\MpdfException: Temporary files directory /var/www/html/vendor/mpdf/mpdf/src/Config/../../tmp is not writable in Mpdf\Cache

This is because nothing in the vendor map is writable on my server. Add a 'tempDir' setting when instantiating the class.

$mpdf = new Mpdf(
   ['tempDir' => '/tmp']
 );