dompdf character encoding UTF-8

后端 未结 11 2023
我在风中等你
我在风中等你 2020-12-01 21:07

Im trying to create pdf with correct characters, but there are \"?\" chars. I created a test php file, where Im trying to fing the best solution. If Im open in the browser t

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 21:28

    I got UTF-8 characters working with this combination. Before you pass html to DOMpdf, make encoding covert with this:

    $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
    

    Use DejaVu font in your css

    *{ font-family: DejaVu Sans; font-size: 12px;}
    

    Make sure you have set utf-8 encoding in HTML tag

    
    

    Now all special characters are working "ľ š č ť ž ý á í é"

提交回复
热议问题