dompdf special characters

后端 未结 5 791
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-11 15:21

I\'m having successful html-to-pdf conversions, but not with special characters.

Below is just a special character I\'m trying to display, which displays in browsers

5条回答
  •  清歌不尽
    2020-12-11 16:01

    Anything prior to 0.6.x has limited support for characters outside iso-8859-1 encoding. The Euro is supported in 0.5.x by using the appropriate Windows ANSI character code (), but otherwise you have to jump through some PDF encoding hoops.

    The 0.6.0 release has better support for "special" characters. The default encoding is based on Windows ANSI (one of the few recognized by the PDF 1.3 spec). You can enable better character support by loading a Unicode-based font and enabling Unicode in dompdf and specifying that encoding in your document.

    The following should work in dompdf 0.6.0 or greater:

    
    
    
      
    
    
      

    (or to be lazy just use the euro entity in your test)

    There is a document outlining the steps needed to enable Unicode support in DOMPDF. Plus read this answer for an overview of how to load fonts.

提交回复
热议问题