mPDF Manual – mPDF Variables

useSubstitutions

(mPDF ≥ 4.2)

useSubstitutions – Specify whether to substitute missing characters in UTF-8 (multibyte) documents

Description

void useSubstitutions

Specify whether to substitute missing characters in UTF-8(multibyte) documents. Characters which cannot be displayed in the current set font, will be substituted by characters in the Adobe core fonts (Symbol, Zapfdingbats etc.), or the backup font(s) specified in the variable in backupSubsFont configuration variable.

Values

$useSubstitutionstrue|false

Values

  • true: enable substitution
  • false: disable substitution

Default: false

Changelog

Version Description
4.2 Variable was added. Controlled behaviour when using Adobe core fonts
5.0 Changed to control behaviour of multibyte documents

Example

<?php
// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf('UTF-8');

$mpdf->useSubstitutions = true;

$mpdf->WriteHTML("Hello World");
$mpdf->Output();

Fork me on GitHub