mPDF Manual – mPDF Variables

allow_charset_conversion

(mPDF >= 1.0)

Description

boolean allow_charset_conversion

When TRUE, mPDF will attempt to parse the character set of any input HTML. You can also use it together with $charset_in to manually set an input encoding.

Values

$allow_charset_conversion = TRUE FALSE

Values

TRUE: DEFAULT Parse the character set of any input text from the HTML, or allow setting of the value $charset_in

FALSE: Expect all text input as UTF-8 encoding.

Examples

Example #1

<?php

$html = '

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-4" />

<title>Document in Lithuanian</title>

</head>

<body>

... the body of the document encoded in ISO-8859-4 ...

</body>

</html>';

$mpdf = new mPDF();

$mpdf->allow_charset_conversion = true;

$mpdf->WriteHTML($html);

$mpdf->Output();

?>

Example #2

<?php

$html = '... the body of the document encoded in ISO-8859-4 ...';

$mpdf = new mPDF();

$mpdf->allow_charset_conversion = true;

$mpdf->charset_in = 'iso-8859-4';

$mpdf->WriteHTML($html);

$mpdf->Output();

?>

See Also