mPDF Manual – mPDF Utilities

strcode2utf()

(mPDF >=1.0)

strcode2utf – Convert HTML numerical entities to UTF-8 encoded string

Description

string strcode2utf ( string $text [, boolean $low ])

Returns a UTF-8 encoded string.

Parameters

$text

The input string, containing HTML numerical entities e.g. Ά or •

$low

Specifies whether to convert HTML numerical entities of ASCII characters (< 128).

Default: true

Values

  • true: Convert all HTML numerical entities to UTF-8 characters
  • false: Only convert characters above codepoint 127

Return value

Returns a UTF-8 encoded string.

Examples

<?php
$mpdf = new \Mpdf\Mpdf();

$wm = strcode2utf("&#1575;&#1610;&#1604;&#1575;&#1578; &#1601;&#1610;&#1605;&#1575; 
    &#1575;&#1610;&#1604;&#1575;&#1578; &#1601;&#1610;&#1605;&#1575;");
$mpdf->SetWatermarkText($wm);

$mpdf->showWatermark = true;

$mpdf->WriteHTML('Hello World');

See Also

Fork me on GitHub