0

i trying to create pdf file with dompdf i have those Miscellaneous Symbols specific ☐ or this

they don't show up in generated PDF instead i got Question mark ?

replace the character

i tried of all those solutions dompdf special characters

Special characters with dompdf and php

Community
  • 1
  • 1

1 Answers1

1

Really this is more of a general "how do I get dompdf to support X character" question. The issue relates to the character set encoding (which relates to the font used).

First, you need to specify a character set encoding that supports the character your specified. In pretty much all instances you should encode to UTF-8.

Second, you'll need to use a font that supports the particular glyphs you want and the font needs to be loaded into dompdf. For the particular character you've specific you can use the DejaVu fonts (e.g. DejaVu Sans) bundled with dompdf starting with v0.6.0.

Try the following:

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <style>
    * { font-family: DejaVu Sans, sans-serif; }
  </style>
</head>
<body>
  <p>&#9744;</p>
  <p>☐</p>
</body>
</html>

And see here for information on how to install fonts: https://stackoverflow.com/a/24517882/264628

Community
  • 1
  • 1
BrianS
  • 13,284
  • 15
  • 62
  • 125