mPDF Manual – mPDF Variables

charset_in

(mPDF >= 1.0)

Description

string charset_in

Defines the character encoding of any input HTML. Use it together with $allow_charset_conversion to manually set an input encoding.

Values

$charset_in

Values (case-insensitive)

  • Any string value allowed which is valid for the PHP function iconv(). This appears to vary depending on the local configuration. See the manual entry for iconv for usual values. You may need to use 'cp1252' or 'windows-1252' instead of 'win-1252', or 'iso-88591' instead of 'iso-8859-1'.
  • BLANK or omitted: Expect all text input as UTF-8 encoding.

Examples

Example #1

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

$mpdf = new \Mpdf\Mpdf();

$mpdf->allow_charset_conversion = true;
$mpdf->charset_in = 'iso-8859-4';
$mpdf->WriteHTML($html);

$mpdf->Output();

See Also

Fork me on GitHub