mPDF Manual – Installation & Setup

Folders for temporary files

mPDF is configured to use [your_path_to_mpdf]/tmp/ as a folder to write temporary files (mainly for images), and [your_path_to_mpdf]/ttfontdata/ as a folder to cache font metrics data. Write permissions should ideally be set on both these folders to allow read/write access for the script.

Images

If you wish to use a different folder for temporary files, you should define the constant _MPDF_TEMP_PATH before including the mpdf.php file e.g.

<?php

define("_MPDF_TEMP_PATH", '../../common/tempfiles/');

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

$mpdf = new mPDF();

Images will still be processed without write permissions to this folder, but at considerable cost in processing time and memory usage.

Fonts

If you wish to use a different folder for temporary files, you should define the constant _MPDF_TTFONTDATAPATH before including the mpdf.php file

Fonts can still be used and embedded without write permissions to this folder, but at some cost in processing time and memory usage.