Monday, September 26, 2011

Printing ® character in PDF which is created with tcpdf [PHP]


When you create UTF-8 PDF document with tcpdf and you want to write some html symbols then you have to encode that character symbol to utf-8.

e.g.
$description = "Hello ® World"
echo str_replace('®', utf8_encode("\xae"), $description);

It will write ® to PDF instead ® text. [Output in PDF document : Hello ® world]

'ae' is the hex value of the ® symbol.


For more symbol to hex value please follow this link : http://allwebco-templates.com/support/S_hex.htm

No comments: