mPDF Manual – Installation & Setup

Installation v5.x

First-time users


  • Download the .zip file and unzip it
  • Create a directory e.g. /mpdf on your server
  • Upload all of the files to the server, maintaining the directories as they are
  • Ensure that you have write permissions set for the following fol
    • /ttfontdata/
    • /tmp/
    • /graph_cache/

To test the installation, point your browser to the example files directory e.g. [path_to_mpdf_folder]/mpdf/examples/

If you wish to install additional fonts please see the notes in Fonts & Languages for further instructions.

If you wish to define a different directory for temporary files rather than /tmp/ see the note on ‘directory for temporary files’.

If you have problems, please read the section on troubleshooting in the manual.

Upgrading from version mPDF 5.0 Beta

There is no upgrade package from v5 beta because so many of the files have had at least minor changes. You can overwrite most of the files, taking care to keep a note of your 3 configuration files.

Important: You must delete all temporary files in the /ttfontdata folder.

Changes from 5.0 Beta

  • config.php file has been changed (extra CJK characters to recognise CJK blocks)</li>
  • $this->backupSubsFont (in config_fonts.php) optionally now takes an array</li>
  • no need to define 'cjk'=&gt;true or 'sip|smp'=&gt;true in config_fonts.php (ignored; cf. $this->BMPonly)</li>
  • Indic language fonts have been altered to add Latin and Latin-1 Supplement characters</li>
  • progress bars now has an external progbar.css and configurable main heading</li>
  • added initial parameter new mPDF('+aCJK') or '-aCJK' to override default useAdobeCJK at runtime</li>
  • QRCode is not included in main download (but as an extra package)</li>

Earlier versions

If you have been using earlier versions of mPDF, most scripts should work as before. But note:

  • Arial, Helvetica, Times and Courier are now treated like any other font
  • the whole CSS font string is parsed e.g. style=”font-family:’Lucida Grande’;” will look for a font
    ‘lucidagrande’ and not ‘lucida’

Configurable variables:

  • $mpdf->useSubstitutionsMB is now deprecated, but will work as an alias for $mpdf->useSubstitutions
  • $mpdf->useOnlyCoreFonts is now deprecated and is ignored. Use new mPDF('c')
  • $this->use_CJK_only is now deprecated and is ignored. See $this->useAdobeCJK and new mPDF('+aCJK') or '-aCJK'

The initial parameters e.g. new mPDF('utf-8') have all changed. Old ones may be recognised, or will be ignored.

Fork me on GitHub