strcode2utf()
(mPDF ≥1.0 && < 7.0)
strcode2utf – Convert HTML numerical entities to UTF-8 encoded string
Note: in mPDF ≥ 7.0 use \Mpdf\Utils\UtfString::strcode2utf
method.
Description
string strcode2utf ( string $text [, boolean $low ])
Returns a UTF-8 encoded string.
Note: strcode2utf()
is useful for preparing text to be
used as a Watermark, or for the metadata properties of Title, Author, Creator and Keywords - which require UTF-8
encoded strings with no entities.
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 charactersfalse
: Only convert characters above codepoint 127
Note: This function does not convert named character
entities like &
, "
or »
Return value
Returns a UTF-8 encoded string.
Changelog
Version | Description |
---|---|
1.0 | Function was added. |
7.0 | Function was removed in favor of \Mpdf\Utils\UtfString::strcode2utf static class method |
Examples
<?php
$mpdf = new \Mpdf\Mpdf();
$mpdf->showWatermark = true;
$wm = \Mpdf\Utils\UtfString::strcode2utf("ايلات فيما
ايلات فيما");
$mpdf->SetWatermarkText($wm);
$mpdf->WriteHTML('Hello World');
See Also
- SetWatermarkText() - Sets the text to use for a Watermark
- SetTitle() - Set document Title in metadata
- SetAuthor() - Set document Author in metadata
- SetCreator() - Set document Creator in metadata
- SetSubject() - Set document Subject in metadata
- SetKeywords() - Set document Keywords in metadata