Directories for temporary files
mPDF is pre-configured to use
<path to mpdf>/tmp as a directory to write temporary files
(mainly for images and fonts).
It is advised to set custom temporary directory as the default temporary directory is in composer
Permissions must be set for read/write access for the specified path.
If you wish to use a different directory for temporary files, you should define
tempDir key in constructor
Note: Never use
777 permissions for directories as those can mean a security issue.
<?php // Require composer autoload require_once __DIR__ . '/vendor/autoload.php'; $mpdf = new \Mpdf\Mpdf(['tempDir' => __DIR__ . '/custom/temp/dir/path']);
<7.0, there are constants
_MPDF_TTFONTDATAPATH which can be used to alter
default temporary files directories.
Up to version 6.x, Images will still be processed without write permissions to the temp directory, but at considerable cost in processing time and memory usage.
Up to version 6.x, fonts can still be used and embedded without write permissions to this directory, but at some cost in processing time and memory usage.